
Philip
Staff Alumni-
Posts
4,665 -
Joined
-
Last visited
-
Days Won
20
Everything posted by Philip
-
/* build selection list for the year */ $today = time(); $startYr = date("Y", $today); //get the year from $today echo "<select name='syear'>\n"; $endYr = $startYr-90; // get the date you want to end up at for ($syear=$startYr;$syear<=$endYr;$syear--) { echo " <option value=$syear"; if ($startYr == $syear ) { echo " selected"; } echo "> $syear\n"; } echo "</select>\n";
-
Also, are magic quotes on and you are using addslashes( ) That would put like: Then stripslashes only takes one set away:
-
As thorpe said, you need to sanitize your input.... But the query problem lies here: `city2` = '{$_POST['city2']}, (You're missing a ' ) `city2` = '{$_POST['city2']}',
-
Im glad you think so
-
Would if a number is between 1 and 4 automatically knock the other 2 qualifications out? If the number is 0, its not between 1 and 4, and if the number is 3, 3 isn't greater than 750, lol By the way, if you check if that number is between 1 and 4, including 1 and 4: if($var >= 1 && $var <=4)
-
You deleted it from the wrong location. Note: _dl, not _cats
-
while($row_rs_multi_dl = mysql_fetch_assoc($rs_multi_dl)); } That } afterwards is not needed. Proper indenting would help
-
Look at this line with a syntax highlighter: echo "<div class='catdetail_header'><h1 class="style1">'.ucwords($row_rs_multi_dl['category']).'</h1>" ; echo '<div class="catdetail_header"><h1 class="style1">'.ucwords($row_rs_multi_dl['category']).'</h1>' ; See the difference?
-
http://locusmeus.com/html-css/centerexample3.html
-
[SOLVED] Php5 array not working, worked in php4
Philip replied to noexcal's topic in PHP Coding Help
As CV suggested - just use an array and cut out the middleman while($app_info = $database->database_fetch_assoc($app)) { $app_array[] = $app_info; } You'd have to change your query a little bit (select exactly what you want) $app_query = "SELECT `user_id`,`app_info1`,`item_id`,`profile`,`name`,height`,`width`+10 as width FROM se_apps WHERE user_id='".$this->user_info[user_id]."' AND app_info2=1 AND profile=1 ORDER BY order_id ASC LIMIT 0,30"; -
Well, I admit I made a mistake in my earlier code: <?php session_start(); if(isset($_SESSION['auth']) && $_SESSION['auth']!='yes') { session_destroy(); $_SESSION['auth']=""; // you want to set this, not compare it } header("Location: /test/project12.php"); // always redirect to home ?> should be: <?php session_start(); if(isset($_SESSION['auth']) && $_SESSION['auth']=='yes') { session_destroy(); $_SESSION['auth']=""; // you want to set this, not compare it } header("Location: /test/project12.php"); // always redirect to home ?> my apologies
-
Look at it with syntax highlighting: $delete_sql = "DELETE FROM jos_facileforms_subrecords WHERE name LIKE \'%'.$badword.'%\' "; $delete_sql = "DELETE FROM jos_facileforms_subrecords WHERE name LIKE '%".$badword."%' ";
-
Let's go back to the basic operators: Assignment operator: $a = 1 Assigns value 1 to variable a Equal operator: if($a==1) Check to see if variable a is equal to 1 Not equal operator (not and equal operator combined ): if($a!=1) Check to see if variable a is not equal to 1 So... <?php if (isset($_SESSION['auth']) && $_SESSION['auth']== "yes") { echo "signed in"; } else { echo "Log in please"; } ?> <?php session_start(); if(isset($_SESSION['auth']) && $_SESSION['auth']!='yes') { session_destroy(); $_SESSION['auth']=""; // you want to set this, not compare it } header("Location: /test/project12.php"); // always redirect ?>
-
Again, you're using just 1 equal sign, instead of the comparison sign (==)
-
if (@$_SESSION['auth'] = "yes") should be if (@$_SESSION['auth'] == "yes") And really, the whole code should be this (IMO): <?php session_start(); if(isset($_SESSION['auth']) && $_SESSION['auth']!='yes') session_destroy(); header("Location: home.php"); ?>
-
SEO board: http://www.phpfreaks.com/forums/index.php/board,102.0.html A topic that is pretty similar: http://www.phpfreaks.com/forums/index.php/topic,213847.0.html Hopefully that helps
-
what error ? Caused by the ticks around the 2 in the limit clause. They shouldnt be there
-
[SOLVED] Get variables not working correctly
Philip replied to sillysillysilly's topic in PHP Coding Help
The separator for GET vars is &, not ? foo.php?bar=something&other=5 -
while($row = mysql_fetch_assoc($result)) { echo $row['Title']; echo $row['SubTitle']; } you're calling for Title, when it should be title - same with subtitle
-
Or the modulus operator. Not tested, just thrown together quickly: <?php $i = 0; do { if($i%2==0) { ?> <tr> <td width="50%"><a href="http://<?php Echo $row_RS2['URL'] ?>" target="_blank" class="V12"> <?php Echo $row_RS2['employer'] ?> </a></td> <?php } else { ?> <td><a href="http://<?php Echo $row_RS2['URL'] ?>" target="_blank" class="V12"> <?php Echo $row_RS2['employer'] ?> </a></td> </tr> <?php } $i++; } while ($row_RS2 = mysql_fetch_assoc($RS2)); if($i%2>0) { echo '<td></td></tr>'; // in case of ending in an odd number of columns } ?>
-
travellingbuttons('Y','coords','1',50,50,'1'); $GetArray = travellingbuttons(); should be $GetArray = travellingbuttons('Y','coords','1',50,50,'1');
-
You'd use an array function someFunc( ) { $array = array('foo', 'bar'); return $array; } $myValue = someFunc(); // myValue now is an array with [0] => "foo" and [1] => "bar"
-
I don't think putting in tags automatically would be a good solution. A simple check to see if there are code tags (<?php, <html>, etc) outside of or [php] tags, then generate a warning (much like the one that says "Warning: someone has replied blah blah"). Something like the following would suffice I think.[color=red][b]Warning:[/b] you currently have code outside of [code] tags, this will disable any formatting of the code[/color] Even so, that could get annoying when you type a short 4 line reply like: <?php session_start(); // don't forget the line above! ?> And, it most likely wouldn't be able to detect snippits without opening tags: $foo = 'bar'; echo $foo; As mentioned before, it's up to the OP. But it is super annoying viewing posts with code not in or
-
I'll agree, prepared statements are pretty awesome