Jump to content

taquitosensei

Members
  • Posts

    676
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by taquitosensei

  1. I gave a bad example. That example uses pear MDB2 class. You can ignore it.
  2. // 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 { }
  3. 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.">";
  4. if($var) { } checks for a boolean True, which would be 1 or True/TRUE/true if(!$var) { } checks for false
  5. 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
  6. 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" />
  7. do a print_r on $res or echo the query out and paste it into your MySQL client. $query = "SELECT max(`time`) as t FROM messages WHERE receiver='$receiver' AND username='$username'"; $res = mysql_query($query); print_r($res); to make sure that everything with the query went fine.
  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]);
  9. explode it on the , $string="52.88239122226187, -0.3515625"; $string_exp=explode(",", $string); $coord=array( 'xcoord'=>$string_exp[0], 'ycoord'=>$string_exp[1] );
  10. 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");
  11. 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.
  12. 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
  13. I'd do this $fcontent = file('./msgs.txt'); foreach($fcontent as $line){ // explode on the tab separating line number from the line contents $line_exp=explode("\t", $line); echo $line_exp[1]."<br>"; // $line_exp[0] would be the number in your file }
  14. 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/
  15. This should work. foreach($row as $key=>$value) { ${strtolower($key)}=$value; }
  16. try using a relative URL for the post action something along these lines echo "<form method='POST' action='test.html'>";
  17. if(isset($_POST['submit']) && $_POST['submit']!="Whatever")) // or =="Whatever" { // Do stuff here }
  18. 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
  19. Do an link back to the same page like <a href='index.php?content=faq'>FAQ</a> then load the content div based on $_GET['content']
  20. There's no commas in between your data sets
  21. This should work $sql = mysql_query('SELECT *,substr(desc,20) as desc FROM `games` WHERE `authorsite`="yippigames" ORDER BY RAND() LIMIT 0, 3') or mysql_error();
  22. 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"; }
  23. try readOnly instead of disabled. You might have to have "cross browser" solution.
  24. 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
  25. 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++; } }
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.