Baffled here: I am looking at a bunch of code written in PHP4 but running under PHP5 – the code (abridged) looks like:
$pid=(int)$customer_exists['pid'];//this value comes from an earlier query & does exist
$query2 = mysql_query("SELECT * FROM `products` AS p, `products_description` AS pd WHERE pd.products_id=p.products_id AND p.products_id='".(int)$pid." '" );
This gets no result from the database.
If the first line is changed to $pid=28; or if the query is changed to just search one table then we get a result.
Echo out $pid before and after the query will echo the value assigned in line 1
(have tried many versions of the actual $query2 – all get the same non-result)
What am I missing here?
Can you try changing this
to
theres a space after double quote and before single quote which you don’t need.
Also, you don’t need
(int)here as you already do it in the previous line.Let me know if it works.