Re: another php/mysql problem

From: Date: Wed, 25 Jul 2001 09:25:41 +0000
Subject: Re: another php/mysql problem
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-10740@lists.php.net to get a copy of this message
Matt Nigh schrieb: > Matt Nigh > > <?php > $link = mysql_connect("localhost","username","password"); > if(!$link) die ("Could not connect to MySQL!"); > mysql_select_db("almavale_board",$link); > if (!isset($band)) { > die("No artist specified."); > } > $sql = "select * from bands where (nospaces_bands = '$band')"; > $result = mysql_query($sql); > if (mysql_num_rows($result) <= 0) { > die("Sorry, there was no artist found by that name."); > } > if (!$my_row = mysql_fetch_array($result)) { > die("Please specify an artist."); > } > $band = "nospaces_bands"; > $band_spaces = "band_bands"; > $id = "id"; > $email = "email"; > echo "<b>band name without spaces:</b> " . $my_row["$band"]; > echo "<br><b>band name with spaces:</b> " . > $my_row["$band_spaces"]; > echo "<br><b>id:</b> " . $my_row["$id"]; > echo "<br><b>email address:</b> " . $my_row[$email]; > > $band_spaces = $artist; > > mysql_select_db("almavale_board",$link); > $sql_01 = "select * from shows where (artistname = '$artist')"; > $result_01 = mysql_query($sql_01); > if (mysql_num_rows($result_01) <= 0) { > die("<br><br>No shows found."); > } > $my_row_01 = mysql_fetch_array($result_01); > > $artist = "artistname"; > $venue = "venue"; > $time = "time"; > echo "<br><br><hr><b>artist name with spaces:</b> " . > $my_row_01["$artist"]; > echo "<br><b>venue:</b> " . $my_row_01["$venue"]; > echo "<br><b>time:</b> " . $my_row_01["$time"]; > > $artist = $band_name; > > mysql_select_db("almavale_releases",$link); > $sql_02 = "select * from releases where (bandname = '$band_name')"; > $result_02 = mysql_query($sql_02); > if (mysql_num_rows($result_02) <= 0) { > die("No releases found."); > } > $my_row_02 = mysql_fetch_array($result); > $band_name = "bandname"; > $albumtitle = "albumtitle"; > $email = "email"; > echo "<br><br><hr><b>artist name with spaces from > releases:</b> " . $my_row_02["$artist"]; > echo "<br><b>album name:</b> " . > $my_row_02["$albumtitle"]; > echo "<br><b>album code:</b> " . > $my_row_02["$albumcode"]; > > mysql_close($link); > ?> What do you exactly want to do? And what is that? $band = "nospaces_bands"; $band_spaces = "band_bands"; $id = "id"; $email = "email"; Why don't you do this: echo "<b>band name without spaces:</b> " . $my_row["band"]; echo "<br><b>band name with spaces:</b> " . $my_row["band_spaces"]; echo "<br><b>id:</b> " . $my_row["id"]; echo "<br><b>email address:</b> " . $my_row[email]; Greetings Kobi

« previous php.db (#10740) next »