Distinct values from while loop

I have a database with a field called part_name. with the values: Front Control Arm, Rear Control Arm I need to echo out only Control Arm, once only. As of now what i'm getting on the while loop results is Control Arm, Control Arm. Need to echo out distinct values from while loop results. I can't do it on the SQL query SELECT DISTINCT because i'm preg replacing the value from t

while循环的不同值

我有一个名为part_name的字段的数据库。 与价值观: Front Control Arm, Rear Control Arm 我只需要一次只回出控制臂。 截至目前,我在while循环结果上得到了什么 Control Arm, Control Arm. 需要从while循环结果中回显出不同的值。 我无法在SQL查询SELECT DISTINCT上做到这一点,因为我想从我正在对数据库进行排队的行中替换值。 while ($rowsparts = mysql_fetch_array($displayparts)) { $part=''.$rowsparts[

session variable (kind of) not loading

I'm using session variables to keep track of login information. Specifically whether a user is logged in (boolean $_SESSION["loggedin"]) and their username (string $_SESSION["username"]). The Homepage has a navigation bar that displays a different set of links depending on whether the user is logged in, by referring to $_SESSION["loggedin"]. This works under

会话变量(种类)不加载

我使用会话变量来跟踪登录信息。 特别是用户是否登录(布尔$ _SESSION [“loggedin”])和他们的用户名(字符串$ _SESSION [“用户名”])。 主页有一个导航栏,根据用户是否登录,通过引用$ _SESSION [“loggedin”]显示一组不同的链接。 除了用户在登录认证后被重定向到主页时,这在任何情况下都适用。 如果我重新加载主页,它并不重要,它仍然显示错误的链接集。 ..但是,如果然后转到登录页面(当$ _SESSION [“loggedin”== =

Pulling two single variables from a Session Array

I have a session that is created and stored. On another page, I want to pull two variables from this session. One of the variables I want to echo as a welcome and the other I want to use in a query to update a mysql table. I just can't quite seem to figure out the correct wording as I have really not worked with sessions and someone else created the initial code. The session name is what

从会话数组中提取两个单变量

我有一个创建和存储的会话。 在另一页上,我想从这个会话中提取两个变量。 其中一个变量我想作为欢迎来回应,另一个我想在查询中使用来更新mysql表。 我似乎无法弄清楚正确的措辞,因为我真的没有和会话一起工作,而其他人也创建了初始代码。 会话名称是真正给我带来麻烦的。 以下是命名会话的代码: $directory = "http://$serverName/".$journalName['db']; mysql_connect('server','user','pass'); mysql_select_db($jo

Set SQL results to SESSION equivalent

With a table setup as follows: CID | FNAM | LNAME | CITY ------> 30 more fields 23432 | John | Doe | Denver 54342 | Jane | Doe | Boston and when getting a result set this way (The query narrowed it down to 1 result): $data = mysqli_query($con,$query); $row = mysqli_fetch_array($data); and using below to set each returned column in $row to a equivalent SESSION variable foreach ($row

将SQL结果设置为与SESSION等效

使用表格设置如下: CID | FNAM | LNAME | CITY ------> 30 more fields 23432 | John | Doe | Denver 54342 | Jane | Doe | Boston 并以这种方式获取结果集时(查询将其缩小为1个结果): $data = mysqli_query($con,$query); $row = mysqli_fetch_array($data); 并使用下面的方法将$ row中的每个返回列设置为等效的SESSION变量 foreach ($row AS $key=>$value) {$_SESSION["$key"]=$value;} 为什么我得到一

php ajax control session variables disappearing

I have a page where a user logs in and some session variables are set: $_SESSION['username'] = "Bob Smith"; $_SESSION['company'] = "acme Co"; $_SESSION['someData'] = "yes"; so far so good. now the user is at landing.php and here i have a series of links on left side that users user for navigation. <li class='menu' id='createUser'>Create New user</li> <li class='menu' id='modUs

php ajax控制会话变量消失

我有一个用户登录的页面,并设置了一些会话变量: $_SESSION['username'] = "Bob Smith"; $_SESSION['company'] = "acme Co"; $_SESSION['someData'] = "yes"; 到现在为止还挺好。 现在用户在landing.php,在这里我有一系列用户用于导航的左侧链接。 <li class='menu' id='createUser'>Create New user</li> <li class='menu' id='modUser'>Modify User</li> <li class='menu' id='reports'>R

PHP adds "532142118" to session variable

I've got a very strange problem with hopefully a very simple explanation, but after hours of debugging I can't figure out what's happening. LAMP stack is used, php 5.4 Here is a simplified version of the system wich still reproduces some strange behavior. In a simple, self made framework, I made a horizontal menu (tabs) wich 'remembers' what url was active when the page

PHP向会话变量添加“532142118”

我有一个非常奇怪的问题,希望有一个非常简单的解释,但经过几个小时的调试后,我无法弄清楚发生了什么。 使用LAMP堆栈,php 5.4 这里是系统的简化版本,它仍然重现了一些奇怪的行为。 在一个简单的自制框架中,我制作了一个水平菜单(标签),当该标签中的页面用于搜索等时,它会记住'哪个网址处于活动状态。因此,如果稍后再回到该标签,您可以立即看到最后的搜索结果,因为get参数。 因此,菜单中的一个“选项卡”

Pass session variable to new page when link is clicked

I'm having a bit of trouble with this. I have a search results page of books with various links, all linking to the same page (book.php) and I want to set a session variable to pass through to the new page which should display more info about the specific result link that is selected. I am trying to pass the variable $_SESSION['booktitle'] through to book.php when the link in the wh

单击链接时将会话变量传递到新页面

我在这方面遇到了一些麻烦。 我有一个带有各种链接的书籍的搜索结果页面,所有链接到同一页面(book.php),我想设置一个会话变量传递到新页面,该页面应该显示更多关于特定结果链接的信息,即选择。 我试图在while循环中的链接被选中时将变量$ _SESSION ['booktitle']传递给book.php。 搜索结果页面的代码是: <form id="rform" name="formsort" action="" method="post"> <select name="sort" id="sort"

AJAX does not carry session variables

I have a centralized index page that contains all of my pages. Inside this index page, I have my session started. I tested this by echoing out all variables, it works. On the AJAX php script, I try to call a session variable, and it seem to print anything out: not even a session id. According to my research, you need to call session_start() on the AJAX script. I did so, and it starts the se

AJAX不会携带会话变量

我有一个集中的索引页面,其中包含我的所有页面。 在此索引页面内,我开始了我的会话。 我通过回应所有变量来测试它,它工作。 在AJAX php脚本中,我尝试调用一个会话变量,它似乎打印出任何东西:甚至没有会话标识。 根据我的研究,你需要在AJAX脚本上调用session_start()。 我这样做了,它开始了会话,但使用了不同的ID,并且没有访问主网站上设置的会话变量。 在Google的前5页中,我没有发现任何内容来复制我的问题

Passing sessions variables through an iframe, php

First timer to the site, not an overly experienced php programmer here :) I have a problem, i am using an iframe within a site which im attempting to use a session variable inside, firstly ive just been trying to display the session variable to make sure they are accessible from within the iframe: echo "session of productcheck ".$_SESSION['productcheck']." "; echo "session of productc

通过iframe,php传递会话变量

第一次到网站的计时器,而不是一个经验丰富的PHP程序员在这里:) 我有一个问题,我在一个站点内部使用了一个iframe,它试图使用一个会话变量,首先我试图显示会话变量,以确保它们可以在iframe中访问: echo "session of productcheck ".$_SESSION['productcheck']." "; echo "session of productcheck1 ".$_SESSION['productcheck1']." "; echo "session of productcheck2 ".$_SESSION['productcheck2']." ";

JOIN Query In MYSQL and PHP

I am going to generate specific information from all the tables in MYSQL. I have 5 tables in my database. Ie: advertiser CREATE TABLE advertiser ( Adv_id int(11) NOT NULL AUTO_INCREMENT, Name char(20) NOT NULL, F_Name char(20) NOT NULL, Address varchar(40) NOT NULL, CNIC int(13) NOT NULL, Contact int(11) NOT NULL, Monthly_fee varchar(10) NOT NULL, Region varchar(10) NOT NULL

在MYSQL和PHP中加入查询

我将从MYSQL中的所有表中生成特定的信息。 我的数据库中有5个表格。 即: 广告 CREATE TABLE advertiser ( Adv_id int(11)NOT NULL AUTO_INCREMENT, Name char(20)NOT NULL, F_Name char(20)NOT NULL, Address varchar(40)NOT NULL, CNIC int(13)NOT NULL, Contact int(11)NOT NULL, Monthly_fee varchar(10)NOT NULL, Region varchar(10)NOT NULL, Reg_date varchar(10)NOT