Jump to content

wipeskim

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

wipeskim's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi, I am doing a script with php and mysql wich i want to list the orders details such as session_id, date, username and id. To do this i used select distinct session_id from orders cause i have 2 orders with the same session_id but i also want to list the username, date and id. Since i used to distinct only the session_id it will only print on the screen the session id's. I tryed "select Distinct session_id, username, date,id from orders" but in this case since some fields has diferent values even having the same session_id it will list all the results on the table. Is there anyway of using the select statement to select all the fields and distinguish the session_id so that i can avoid duplicated session id's on the results? If someone can help me i appreciate Many thanks to all
  2. Hi, I am doing a script with php and mysql wich i want to list the orders details such as session_id, date, username and id. To do this i used select distinct session_id from orders cause i have 2 orders with the same session_id but i also want to list the username, date and id. Since i used to distinct only the session_id it will only print on the screen the session id's. I tryed "select Distinct session_id, username, date,id from orders" but in this case since some fields has diferent values even having the same session_id it will list all the results on the table. What i would like to do is like "select * from orders distinct session_id" , this query doesn't work but just to give an idea. Is there anyway of using the select statement to select all the fields and distinguish the session_id so that i can avoid duplicated session id's on the results? If someone can help me i appreciate Many thanks to all
  3. Hi I am having trouble using multiple forms with the checkbox, i am listing results from the database such as the name of the person and the reference number and on the listings i have the checkbox to select the User using the 2 forms to perform the actions one for delete the selected users and other to multiple edit the Users information. The problem is that is only running the Delete User when i press the Edit User button it doesn't show any values from the checkbox i think the form buttons are entering in  conflict. I tryed to close the Edit user Form </form> before the While loop but that doesn't run the checkbox values also. Is there any other way to perform this? This is the code that i am using , on the second file that is actions.php i just put to print the checkbox values: [code] <?  echo "<form id='form1' action='actions.php?action=delete_user' method='post' enctype='multipart/form-data' name='form1'>";    ?>   <input type="submit" name="delete" value="Delete User" />   <?  echo "<form id='form2' action='actions.php?action=edit_user  ' method='post' enctype='multipart/form-data' name='form2'>";  ?>     <input type="submit" name="edit" value="Edit user" /> <? while($result = mysql_fetch_array($sql))    {  ?> <? $ref=$result["reference"];           echo "<INPUT TYPE='checkbox' NAME='checkbox[]' VALUE='$ref'>"; ?> <?  printf("<font color='#000000'>%s</font>",$result["reference"]);  printf("<font color='#000000'>%s</font>",$result["user_name"]);  ?> <?  }  ?>     </form> </form>   -> File actions.php <? require ("setup.php"); $link=mysql_connect("$host","$dbuser","$dbpass"); mysql_select_db("$bdname"); switch ($action) {   case "delete_user":     $checkbox_cnt  = count($checkbox);   for ($i = 0; $i < $checkbox_cnt; $i++)   {     echo $checkbox[$i]; }   break; case "edit_user":     $checkbox_cnt  = count($checkbox);   for ($i = 0; $i < $checkbox_cnt; $i++)   {    echo $checkbox[$i];  }   break; } // End of Switch Case /////////////// ?>[/code] If someone can help me with this i appreciate, Thanks to all Mod edit : Please use code tags
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.