I'm new to PHP and just doing a test site for practice. I've run across the following error:
Notice: Use of undefined constant sql - assumed 'sql' in F:\wamp\www\css\Index.php on line 33
Call Stack
# Time Memory Function Location
1 0.0003 671872 {main}( ) ..\Index.php:0
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in F:\wamp\www\css\Index.php on line 35
Call Stack
# Time Memory Function Location
1 0.0003 671872 {main}( ) ..\Index.php:0
2 1.0141 680104 mysql_fetch_array ( ) ..\Index.php:35
Here's a snip of the portion that it finds erroneous:
30 <?php
31
32 $sql="SELECT * FROM products ORDER BY name ASC";
33 $query=mysql_query(sql);
34
35 while ($row=mysql_fetch_array($query)) {
36
37 ?>
38 <tr>
39 <td><?php echo $row['SKU'] ?></td>
40 <td><?php echo $row['Product'] ?></td>
41 <td><a href="#">Select Product</a></td>
42 </tr>
43 <?php
44 }
45 ?>
I've included the line numbers with the snip. The table that I'm trying to pull from is indeed "products," so I don't think that's the issue here. I've been scratching my head for the past hour or so trying to figure out where the issue is, but I can't figure it out. I guess I should take that as a warm welcome from Father PHP as an initiation rite of passage, huh?