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

 

 

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.