Jump to content

[SOLVED] SQL Query not working


jaxdevil

Recommended Posts

The below query is not returning results. It is something wrong in that query. There are two queries below, the second one does return the values I am looking for, the first one does not, so the variable is being sent properly to the page ( $model_number ) but the first query never returns any results. Please check it and see if you see any errors. Thanks!

 

SK

 

<?php
require($_SERVER['DOCUMENT_ROOT'].'/includes/configs/sql_connect.php');
$sql_media = "SELECT * FROM `products_media` WHERE `model_number`='$model_number' OR `number_search`='$model_number'";
$query_media = mysql_query($sql_media);
while($media = mysql_fetch_array($query_media)){
$image_file = $media['image_file'];
$image_file_thumb = $media['image_file_thumb'];
$pdf_specs = $media['pdf_specs'];
$pdf_specs_thumb = $media['pdf_specs_thumb'];
$pdf_one = $media['pdf_one'];
$pdf_one_thumb = $media['pdf_one_thumb'];
$pdf_two = $media['pdf_two'];
$pdf_two_thumb = $media['pdf_two_thumb'];
$pdf_three = $media['pdf_three'];
$pdf_three_thumb = $media['pdf_three_thumb'];
$pdf_four = $media['pdf_four'];
$pdf_four_thumb = $media['pdf_four_thumb'];
}
$sql_info = "SELECT * FROM `products` WHERE `model_number`='$model_number' OR `number_search`='$model_number'";
$query_info = mysql_query($sql_info);
while($info = mysql_fetch_array($query_info)){
$manufacturer = $info['manufacturer'];
$model_number = $info['model_number'];
$name = $info['name'];
}
?>

Link to comment
https://forums.phpfreaks.com/topic/125117-solved-sql-query-not-working/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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