FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » parameters with numbers
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
parameters with numbers [message #178853] Tue, 14 August 2012 20:16 Go to previous message
houghi is currently offline  houghi
Messages: 45
Registered: September 2011
Karma:
Member
I have something like the following:

<?php
include_once('connect.php');
$ncast_1 = 'nm0001147';
$ncast_2 = 'nm0518718';
$ncast_3 = 'nm0001212';
$ncast_4 = 'nm0004825';
for ($i = 1; $i <= 4; $i++) {
$sql = "SELECT * FROM cast WHERE nconst LIKE '$ncast_1'";
$result = mysql_query($sql) or die(mysql_error());
$row = mysql_fetch_array( $result );
$cast_[$i] = $row['name'];
echo "$cast_[$i] $i <br>";
}
mysql_close($conn);
?>

This works as expected, but not as I want it to work. The $ncast_1 after
the LIKE in the $sql should vary with the value of $i.

I have tried using various things, like $ncast_[$i] which did not work.
At this moment I am in the state of typing almost random characters and
quotes and escapes.

I have something working as it is four only different parameters and I
just repeated the code, instead of using a loop. However I would like to
learn and have no idea what to type into google to do the search.

houghi
--
You are about to enter another dimension, a dimension not only of
sight and sound but of mind. A journey into a wondrous land of
imagination. Next stop, Usenet!
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: PHP Debugger which can set breakpoint and view variables on watch window
Next Topic: PHPUnit documentation
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Mon Nov 25 03:26:31 GMT 2024

Total time taken to generate the page: 0.04830 seconds