Topic awaiting preservation: Dynamic pages in PHP or ASP (Page 1 of 1) |
|
---|---|
Neurotic (0) Inmate Newly admitted From: |
posted 09-29-2005 16:47
Please help! |
Paranoid (IV) Inmate From: A graveyard of dreams |
posted 09-29-2005 18:07
Not really sure what you want, but... code: $titles = ('foobar', 'google', 'all your base'); /* and now print the correct title depending on the id variable passed*/ print $titles[ $_GET['id'] ];
|
Paranoid (IV) Inmate From: 127.0.0.1 |
posted 09-30-2005 14:41
Well, I suspect you're going to need to retrieve more info about the course in order to book it, so I would likely do something with a MySQL database: |
Obsessive-Compulsive (I) Inmate From: |
posted 09-30-2005 16:37
Thanks a lot for ur suggestions, |
Maniac (V) Mad Scientist From: 100101010011 <-- right about here |
posted 09-30-2005 17:44
if ($link_id==1) { // Notice the second equal sign otherwise this will always return true |
Obsessive-Compulsive (I) Inmate From: |
posted 09-30-2005 18:08
can u please tell me where to put the else statement, coz i m using else after code: <?php if ($link_id=="1") { $result=mysql_query("select * from mtc_links where category_id=1 and mtclink_id=1"); $numrows=mysql_num_rows($result); } elseif ($link_id=="2"){ $result=mysql_query("select * from mtc_links where category_id=1 and mtclink_id=2"); $numrows=mysql_num_rows($result);} for($i=0;$i<$numrows;$i++) { $fetchrow=mysql_fetch_row($result); $text=$fetchrow[2]; $link=$fetchrow[3]; $link_id=$fetchrow[0]; ?> <td background="images/artical-middle-curve2.gif" class="body-text"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="2%"> </td> <td width="98%" class="body-text"><?php echo($text);?></td> </tr> </table></td> <?php } ?> |
Maniac (V) Mad Scientist From: 100101010011 <-- right about here |
posted 09-30-2005 18:17
Not sure where your error is but you can use variables in your sql and in this case get rid of the if/elseif altogether. code: $link_id = trim($link_id) // Get rid of any white space if ( is_int($link_id ) ) { // Make sure our link id is an integer $result = .... / all the rest. } else { echo "Invalid Link ID"; }
|
Nervous Wreck (II) Inmate From: |
posted 09-30-2005 18:42
i will not be using any user input,, |
Maniac (V) Mad Scientist From: 100101010011 <-- right about here |
posted 09-30-2005 19:35
First if you are using links like |
Nervous Wreck (II) Inmate From: |
posted 10-01-2005 08:30
thanks a ton, |