Jump to content

VARCHAR and Warning: mysql_fetch_array(): supplied argument


mbester

Recommended Posts

Hi

 

I'm new with PHP and have a small database that return data.

 

I have working templates for certain sections of my website but found the following problem using a database column named Style_No of VARCAR(60).

 

The problem is that I get the following error:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource

 

PHP

$DetailResult = mysql_query("Select Silhouette, Neckline, SleeveLength, SleeveStyle, Fabric, Embellishments, Colour_Description, Style_No from juniormaid_eden_info where Style_No = $Style_No");

while($row = mysql_fetch_array($DetailResult ))

{

$Style_No = $row['Style_No'];

$Silhouette = $row['Silhouette'];

$Neckline = $row['Neckline'];

$SleeveLength = $row['SleeveLength'];

$SleeveStyle = $row['SleeveStyle'];

$Fabric = $row['Fabric'];

$Embellishments = $row['Embellishments'];

$Colour_Description = $row['Colour_Description'];

};

 

 

However, this is the same code that works for another database table that are only populated with numerical values.

 

The problem goes away when I populate the column "Style_No" with only numerical values, i.e.

Style_No = 1234

but as soon as I add alphanumerical values I get the above error, e.g.

Style_No = JM1234

 

It also doesnt work if I for example, change the value as follows

Style_No = JM

 

It seems as if the code doesnt like the alphanumerical values.

 

Is there a problem using the above PHP code and using a value that consist of both numerical and alphanumerical values?

 

Any help will be greatly appreciated.

 

Thanks

 

Mari

 

 

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.