Jump to content

Recommended Posts

  • 4 weeks later...
bump

231880[/snapback]

You didn't need to bump this thread in the first place, someone would eventually get around to it. Considering you only waited a day I was reluctant to help you but since I'm a kind spirited person, I decided to continue with the help.

 

Have you not read enough on SQL to see that it has an AND operator?

 

Try this:

$service = addslashes($_GET['service']);
$type = addslashes($_GET['make']);
# I know this isn't completely secure but it's a good start. You can work 
# the rest out.

$get_info = mysql_query("SELECT * FROM cellphones WHERE service = '" . $service . "' AND make = '" . $type . "'") or die ("Error, could not run query. MySQL: " . mysql_error());
# After getting everything working or if you don't run into any problems
# I would remove the or die statement. It is mainly used for only debuggin
# and the user doesn't need to see the structure of your database to know
# what exactly went wrong.

if (mysql_num_rows($get_info) == 0) {
echo 'No results found.';
} else { # Results were found

echo 'Results:<br /><br />
do { # Execute code

echo 'Service: ' . $info['service'] . '<br />
       Make: ' . $info['make'] . '<br />';

} while ($info = mysql_fetch_array($get_info));

} // End else for if (mysql_num_rows($get_info) == 0)

 

You can always retrieve the rest of the information from your database. I'm not sure if I got the table or fields right but I was just guessing. Fix them if needed.

Link to comment
https://forums.phpfreaks.com/topic/2295-multiable-querys/#findComment-7650
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.