taquitosensei
Members-
Posts
676 -
Joined
-
Last visited
-
Days Won
2
Everything posted by taquitosensei
-
[SOLVED] Problems with count and if staements!
taquitosensei replied to andrew_biggart's topic in PHP Coding Help
I gave a bad example. That example uses pear MDB2 class. You can ignore it. -
[SOLVED] Problems with count and if staements!
taquitosensei replied to andrew_biggart's topic in PHP Coding Help
// Retrieve data from database $sql = "SELECT count(Blog_username) as blogcount FROM User_blogT WHERE Blog_user='$username' "; $result = mysql_query($sql); if($result->numRows() > 3) { echo "You are only allowed to Have 3 entries to your blog at any one time. If you would like to update your blog please delete one of the older entries."; } else { } -
[SOLVED] Help Determining Whether Checkbox Should Be Checked?
taquitosensei replied to limitphp's topic in PHP Coding Help
something along these lines; $genres="1,2,3"; $genres_array=explode(",", $string); if(!in_array($genreID, $genres_array)) { $checked="checked='checked'"; } else { $checked=""; } echo "<input type='checkbox' name='genre[]' value='$genreID' ".$checked.">"; -
[SOLVED] Help with if($var == TRUE) - I'm so close!
taquitosensei replied to nz_mitch's topic in PHP Coding Help
if($var) { } checks for a boolean True, which would be 1 or True/TRUE/true if(!$var) { } checks for false -
[SOLVED] Help with if($var == TRUE) - I'm so close!
taquitosensei replied to nz_mitch's topic in PHP Coding Help
just an FYI you could do it this way $var=True; if($var) { // do whatever you're going to do if you're variable is true } or -
[SOLVED] Apostrophes don't show when outputting data...
taquitosensei replied to webmaster1's topic in PHP Coding Help
try running $newsblock=html_entity_decode($newsblock); echo $newsblock; or check your encoding in your header. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> -
you're asking it to delete where id=filename I'm pretty sure that won't work. Also I would quote it differently. try this $a2 = "DELETE FROM upimgs WHERE yourfilenamefield ='".$_FILES['fl2']['name']."'"; mysql_query($a2); unlink("../upl_imgs/".$_POST["d2"][$i]);
-
explode it on the , $string="52.88239122226187, -0.3515625"; $string_exp=explode(",", $string); $coord=array( 'xcoord'=>$string_exp[0], 'ycoord'=>$string_exp[1] );
-
try this function msort($array, $id="id") { $temp_array = array(); while(count($array)>0) { $lowest_id = 0; $index=0; foreach ($array as $item) { if (isset($item[$id]) && $array[$lowest_id][$id]) { if (strtolower($item[$id])<strtolower($array[$lowest_id][$id])) { $lowest_id = $index; } } $index++; } $temp_array[] = $array[$lowest_id]; $array = array_merge(array_slice($array, 0,$lowest_id), array_slice($array, $lowest_id+1)); } return $temp_array; } then you just call it like this $array=msort($array,"shortName");
-
put this at the top of your script. ini_set("display_errors","2"); ERROR_REPORTING(E_ALL); that will turn on error reporting. Telling you where the error. Usually a white screen means you have an error and error reporting is off.
-
or even better $sql="insert into name(last) values('".mysql_real_escape_string($player1last)."'); takes care of some security issues as well as escaping the string for insert
-
Here's some good info on getting php and apache running on Vista http://senese.wordpress.com/2007/06/06/install-php-5-under-apache-22-and-windows-vista/
-
dynamic variable assignment from query results
taquitosensei replied to moonlightinred's topic in PHP Coding Help
This should work. foreach($row as $key=>$value) { ${strtolower($key)}=$value; } -
try using a relative URL for the post action something along these lines echo "<form method='POST' action='test.html'>";
-
if(isset($_POST['submit']) && $_POST['submit']!="Whatever")) // or =="Whatever" { // Do stuff here }
-
I think you're after $_SERVER['HTTP_REFERER'] if($_SERVER['HTTP_REFERER']=="https://www.paypal.com") { include "thispage.php"; } else { include "thatpage.php"; } the rest of it looks fine
-
There's no commas in between your data sets
-
how to set EXPIRY for HREF Link without using DB
taquitosensei replied to pavanpuligandla's topic in PHP Coding Help
put a createdate in the table. Along with Expiration date. When a user pulls up the page if it's later than the expiration don't display it. if(!date("Y-m-d") > date("Y-m-d", strtotime($row_from_database['expiration_date'])) { echo "Your link here"; } -
try readOnly instead of disabled. You might have to have "cross browser" solution.
-
PHP linked to access/mysql database and in house server
taquitosensei replied to minneyx's topic in PHP Coding Help
create tables with identical structure in mysql then you can link the mysql tables in access using ODBC http://dev.mysql.com/downloads/connector/odbc/5.1.html then run queries in access to insert the data into the linked mysql tables -
How to use the if statement with data from a database?
taquitosensei replied to lavarat's topic in PHP Coding Help
like this $line = 1; while ($row = mysql_fetch_assoc($result)) { if (strtolower($row["is_finalized"])=="yes") // just in case it's Yes or YES { $color_code=""; if($line%2==1) { $color_code="bgcolor='".$this->color_line."'"; } echo " <tr ".$color_code. ">\n"; echo " <tr>\n"; echo " <td>" . $row["submission_id"] . "</td>\n"; echo " <td>" . $row["col_1"] . "</td>\n"; echo " <td>" . $row["col_2"] . "</td>\n"; echo " <td>" . $row["col_3"] . "</td>\n"; echo " <td>" . $row["col_4"] . "</td>\n"; echo " <td>" . $row["col_5"] . "</td>\n"; echo " <td>" . $row["col_7"] . "</td>\n"; echo " </tr>\n"; $line++; } }