PHP - Moved: Mysql Select After A Certain Id?
This topic has been moved to MySQL Help.
http://www.phpfreaks.com/forums/index.php?topic=350716.0 Similar TutorialsThis topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=348309.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=321906.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=318996.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=351005.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=310181.0 This topic has been moved to Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=347691.0 This topic has been moved to Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=320341.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=310935.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=309828.0 This topic is now in MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=357554.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=348848.0 This topic has been moved to Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=359241.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=305968.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=313023.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=343149.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=357712.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=347920.0 I have a MySQL database. The table name is prodcat - it has 3 fields sku, category and codes. Some of the categorys have multiple items in it which is seperated by /
for example: Ceramics/Sale Items or just Ceramics
in the codes it looks like this: ceramics,saleitems or just ceramics
Basically i want to loop through each sku in the prodcat table and every sku that is in ceramics I want it to echo an image. And if that sku is in multiple categories it needs to show the image no matter what category you are in. So if it is a ceramic item that is also on sale I want the image to appear in both those categories
I've tried this multiple ways and can get a partial result but can not get it completely the way I want it. Basically I can get it to give me the result in one category but it won't give me the result in both categories.
Thanks for the help.
Basically, is this a good idea to use, or rather select only the fields you need for a certain reason. Say I have the fields: uid,uname,upass,usalt, and udisplayname. If a sneaky little .... somehow injected a query that is used for users that are logged in, wouldn't it be better to only have the relevant fields selected? ( In this case, uname,upass,and usalt should only be touched if adding a user, or having a user log in, because beyond that, why would you need something that's purpose is only for authenticating a user? ), or rather select all fields?. I've been wondering this for a while. So if I used my method ( select only relevant fields ), even if a sneaky little .... did inject sql to try and get a certain user's login information, it would not give them that info because those fields are NOT selected, as opposed to selecting all fields, and having that sneaky little .... get ahold of that users info.. Still even if I used uname and upass, they'd still have to figure out that I'm using a unique salt for each user, and that even if 2 users have the same password, theyd need to do seperate rainbow tables for each password. What is this a. b. c. before the fields? I'm not understanding it. I know is about foreign key and reference, but why a. b. c. ?? Code: [Select] <?php $user_id='1'; // User table user_id value $update_sql=mysql_query("SELECT a.username, a.email, b.update_id, b.update, b.time, b.vote_up, b.vote_down FROM users a, updates b, friends c WHERE b.user_id_fk = a.user_id AND c.friend_one = '$user_id' AND b.user_id_fk = c.friend_two ORDER BY b.update_id DESC LIMIT 15"); while($row=mysql_fetch_array($update_sql)) { $username=$row['username']; $email=$row['email']; $update_id=$row['update_id']; $update=$row['update']; $time=$row['time']; $up=$row['vote_up']; $down=$row['vote_down']; //Avatar $lowercase = strtolower($email); $image = md5($lowercase); $avatar ='http://www.gravatar.com/avatar.php?gravatar_id='.$image; //Update HTML tags filter $htmldata = array ("<", ">"); $htmlreplace = array ("<",">"); $final_update = str_replace($htmldata, $htmlreplace, $update); // Updates Results Display here } ?> |