Jump to content

[SOLVED] select all rows starting with a


chriscloyd

Recommended Posts

i got this error

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /usr/home/www5965/public_html/CEGL-Work/newsite/adminfiles/viewteams.php on line 12

 

here all the code

<?php
//get teams
//switch on type
switch($_GET['type']) {
case "1":
$name = $_GET['name'].'%';
$get_teams = mysql_query("SELECT * FROM cegl_teams WHERE name LIKE '$name' ORDER BY name ASC");
break;
case "2":
break;
}
while ($teams = mysql_fetch_array($get_teams)) {
echo $teams['name'].'<br>';
}
?>

<?php
//get teams
//switch on type
switch($_GET['type']) {
case "1":
$name = $_GET['name'].'%';
$get_teams = mysql_query("SELECT * FROM cegl_teams WHERE name LIKE '{$name}' ORDER BY name ASC");
break;
case "2":
break;
}
while ($teams = mysql_fetch_array($get_teams)) {
echo $teams['name'].'<br>';
}
?>

 

You need to add the { } around $name

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.