Jump to content

Help with SQL Query and PHP (passing variables via URL)


seb213

Recommended Posts

[quote author=craygo link=topic=123868.msg512650#msg512650 date=1169672650]
That usually means the sql statement is wrong

put this in after the sql
[code]
$query_Recordset2 = "SELECT * FROM products_description
                    JOIN products ON products_description.products_id = products.products_id
                    WHERE products.products_id ='$pid'";
echo $query_Recordset2."<br>";[/code]

And post what the wuery is

Ray


[/quote]


or if you ment for me to put this on my actual page, this is what i get:

[color=red]SELECT * FROM products_description JOIN products ON products_description.products_id = products.products_id WHERE products.products_id ='278'

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /www/snackerz/html/bulke/products/index.php on line 8[/color]
Link to comment
Share on other sites

All of you guys SAVED my fuckin DAY!

Special Thanks to :
[color=red]
The Little Guy

craygo

dgiberson[/color]

What happend was i wrote my QUERY wrong, i had the wrong realtaionship, so i took the query [color=red]dgiberson[/color] gave me, and modified that, and what the hell do you know, im back in business.

[color=green]$pid = $_REQUEST['products_id'];
This is what i needed  :

$query_Recordset2 = "SELECT * FROM products_description pd INNER JOIN products p ON pd.products_id = p.products_id WHERE p.products_id = $pid";[/color]

Thanks so much for your help.


Link to comment
Share on other sites

good stuff, glad to help.... i really suggest creating your queries in phpMyAdmin or MySQL Query Browser first, cause it will return you a little more info versus running it in your php code, the standard not a valid argument error doesn't really help you troubleshoot the query. Then porting it to php becomes a snap
Link to comment
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.