Jump to content

pocobueno1388

Members
  • Posts

    3,369
  • Joined

  • Last visited

    Never

Everything posted by pocobueno1388

  1. Please don't forget to mark the topic as solved.
  2. You need to use double quotes, like this: <?php $webid = $_GET['web_id']; define('UPLOAD_PATH', "/usr/home/website/id/$webid");
  3. <?php if (isset($_GET['kw'])){ //keyword DOES exist, show whatever. } else { //DOES NOT exist, show default } ?>
  4. Try <?php $sql4 ="Update vtiger_invoicecf SET cf_602 = '$mitax', cf_604 = '$formatnet_total' where invoice = '$id'"; $result = mysql_query($sql4) or die(mysql_error() . "<p>With Query<br>$sql4");
  5. You can store it in a database or text file. Take a look at this tutorial for more on working with forms: http://www.tizag.com/phpT/postget.php
  6. Definitely get rid of the Youtube template, no one likes a copycat...especially something with absolutely no originality about it.
  7. Take a look at this topic http://www.phpfreaks.com/forums/index.php/topic,95426.0.html
  8. You never told us what you were trying to do, or what the problem was.
  9. Oops, I accidentally left a line in there. <?php include("dbinfo.inc.php"); mysql_connect(mysql,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $default_event= array('event1', 'event2'); if(isset($_REQUEST['changed']) && count($_REQUEST['changed']) > 0 && !empty($_REQUEST['command'])) { $sql = ""; $insql = "IN('" . join("','",array_keys($_REQUEST['changed'])) . "')"; switch($_REQUEST['command']) { case "Deactivate": $sql = "UPDATE birthdays SET ACTIVE='0' WHERE id " . $insql; break; case "Activate": $sql = "UPDATE birthdays SET ACTIVE='1' WHERE id " . $insql; break; case "Delete": $sql = "DELETE FROM birthdays WHERE id " . $insql; break; } if(!empty($sql)) { mysql_query($sql); } } $where = $url = array(); if(!empty($_REQUEST['event'])) { $where[] = "Event='" . addslashes($_REQUEST['event']) . "'"; $url[] = "event=" . $_REQUEST['event']; } else { $num_of_events = count($default_event); for($i=0; $i<$num_of_events;$i++){ if ($i == 0) { $where_s = "(Event='$default_event[$i]'"; if ($num_of_events <= 1) $where_s .= ')'; $where[] = $where_s; } else { $stop = $i+1; $where_s = " OR Event='$default_event[$i]' "; if ($num_of_events == $stop) $where_s .= ')'; $where[] = $where_s; } } $_REQUEST['event'] = $default_event; } if(strlen($active) > 0) { $where[] = " AND Active='" . addslashes($_REQUEST['active']) . "'"; $url[] = "active=" . $_REQUEST['active']; switch($active) { case 1: $page_type = "ACTIVE"; break; case 0: $page_type = "INACTIVE"; break; } } else { $page_type = "ALL"; } $query="SELECT * FROM birthdays"; if(count($where) > 0) { $query .= " WHERE " . join(" ",$where); } $result=mysql_query($query)or die(mysql_error() . "<p>With Query:<br>$query"); $num=mysql_num_rows($result); mysql_close(); echo "<p><b>$query</b><p>"; //################## Query outputted on this line echo "<A name=\"top\"></A><b><center><H1>Display Records \"<I>$page_type $default_event records</I>\":</H1>"; ?>
  10. Thats a bit overkill, don't you think?
  11. <?php $query = mysql_query("SELECT col FROM table WHERE ID=6")or die(mysql_error()); if (mysql_num_rows($query) > 0){ //the row exists } else { //doesn't exist }
  12. That means there is a problem with one of your queries again. Is this <?php $postssql = mysql_query("SELECT * FROM forum_posts WHERE topicid = '{$topicid}'") or die("Error ($POSTSQL): " . mysql_error());; $posts = mysql_num_rows($query); Supposed to be <?php $postssql = mysql_query("SELECT * FROM forum_posts WHERE topicid = '{$topicid}'") or die("Error ($POSTSQL): " . mysql_error());; $posts = mysql_num_rows($postssql); //Changed this line
  13. I don't see a "topicid" of 0. You need to also remove the single quotes around the 0 from this part of the query: topicid = '0'. Also take away the brackets. I need to get to bed. So any more help you need I will have to do in the morning (unless someone else comes). Why do I need to know that?
  14. Type this query into your SQL in your database and make sure you get two results SELECT * FROM forum_posts WHERE topicid = '1' LIMIT 0, 30
  15. Which is...good? That just means it didn't find any results in the database that match your query.
  16. Oh, duh...you need to get rid of the single quotes in the LIMIT part. <?php $query = "SELECT * FROM forum_posts WHERE topicid = '$topicid' LIMIT $offset, $limit"; $result = mysql_query($query) or die("Error (QUERY): " . mysql_error() . "<p>With Query:<br>$query<p>"); ?>
  17. It should be a lot more than 4 characters shorter if you changed everything I did. Did you actually copy and paste the code? Even better, copy and paste this then copy and paste what it says: <?php $query = "SELECT * FROM forum_posts WHERE topicid = '$topicid' LIMIT '$offset', '$limit'"; $result = mysql_query($query) or die("Error (QUERY): " . mysql_error() . "<p>With Query:<br>$query<p>"); ?>
  18. Your running mysql_query() twice. It should be <?php $query = "SELECT * FROM forum_posts WHERE topicid = '$topicid' LIMIT '$offset', '$limit'"; $result = mysql_query($query) or die("Error (QUERY): " . mysql_error()); ?> I also don't see a need for the brackets around all the variables.
  19. Okay, well you have a ton of queries in there and we have no idea which query is getting that error. In the error message for all your queries you need to number them. Instead of just saying "Error", you should put "Error 1" for the first query and so on.
  20. What do you know, I have a fixed version of that tutorial saved on my computer from helping someone else with it. <?php $limit = 10; $query_count = "SELECT count(*) FROM table"; $result_count = mysql_query($query_count) or die("Error: " . mysql_error()); $totalrows = mysql_result($result_count, 0, 0); $numofpages = ceil($totalrows/$limit); if (isset($_GET['page'])) $page = $_GET['page']; else $page = 1; $offset = ($page - 1) * $limit; $query = "SELECT * FROM table LIMIT $offset, $limit"; echo $query .'<br>'; $result = mysql_query($query) or die("Error: " . mysql_error()); //Exit if no records to display if (mysql_num_rows($result) == 0) { exit("Nothing to Display!"); } while ($row = mysql_fetch_array($result)) { echo $row['col']."</br>"; } //Enable the Prev link if not first page if ($page > 1) { echo("<a href=\"index.php?page=".($page-1)."\">PREV</a> "); } else { echo("PREV "); } //Create links for each page in report for ($i=1; $i<=$numofpages; $i++) { if ($i == $page) { echo "$i "; } else { echo "<a href=\"index.php?page=$i\">$i</a> "; } } //Enable the Next link if not last page if ($page < $numofpages) { echo("<a href=\"index.php?page=".($page+1)."\">NEXT</a>"); } else { echo("NEXT"); } ?> So just replace everything in that code with your information.
  21. A lot of people seem to have trouble with that tutorial. I think there was an error in the code, they may have fixed it though, I'm not sure.
  22. You need to look into pagination, search Google for "PHP pagination tutorial".
  23. Give this a shot <?php $realdate = "2008-01-01"; //We will say this is your timestamp $edited = time(); //convert timestamp to proper format $edited = date("Y-m-d", $edited); //check if $edited is more recent if ($edited > $realdate){ echo "Yes, edited date is more recent"; } else { echo "No, realdate is more recent"; } ?>
×
×
  • 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.