Jump to content

pocobueno1388

Members
  • Posts

    3,369
  • Joined

  • Last visited

    Never

Everything posted by pocobueno1388

  1. Why would you want to do that? What are you doing?
  2. You get the value of the drop-down just like any other value, with the name. So all you would do is $mydropdown1=$_POST['mydropdown1'];
  3. "Working Out" and working out while looking good are two completely different things...in my opinion he still needs a lot of work on the looking good part.
  4. Your quotes are messed up at the end mysql_query("UPDATE login SET lName = '$lName', fName = '$fName', address = '$address', zip = '$zip', phone = '$phone', start_date = '$start_date'")or die(mysql_error()); You do know you don't have a WHERE clause, right? That will update EVERY record in your DB.
  5. Okay, well change your code to this and tell us what it gives you <?php $sql ="UPDATE $table_name SET posttitle ='{$_POST[posttitle]}', postername ='{$_POST[postername]}', posteremail ='{$_POST[posteremail]}', posttxt ='{$_POST[posttxt]}', WHERE postid ='{$_POST[postid]}'"; $result = mysql_query($sql)or die(mysql_error()."<p>With query:<br>$sql"); echo "<p>$sql<p>";
  6. Only select the ones that haven't expired, like this: SELECT * FROM postings WHERE post_date < (NOW() - INTERVAL 30 DAY)
  7. Are you actually running the query? <?php $sql ="UPDATE $table_name SET posttitle ='{$_POST[posttitle]}', postername ='{$_POST[postername]}', posteremail ='{$_POST[posteremail]}', posttxt ='{$_POST[posttxt]}', WHERE postid ='{$_POST[postid]}'"; $query = mysql_query($sql)or die(mysql_error()."<p>With query:<br>$sql"); ?>
  8. You can probably use a text file...but it will be a lot harder and less efficient depending on how much information you store. You could set it up something like this: avatar_img avatar_url keyword, keyword, keyword, keyword, keyword, keyword, keyword, keyword, keyword, keyword I'm not very experienced with working with flat files, so that might not be the best way...if you have already done this with your login, what are you having problems with?
  9. This function may be an embarrassment compared to effigy's method, but here it is. <?php function transform($phrase, $replacer){ $phrase = explode(' ', $phrase); $i=0; foreach ($phrase as $word){ if ($word == '_'){ $word = str_replace('_', $replacer[$i], $word); $i++; } $newphrase .= $word.' '; } return $newphrase; } ?> To use <?php $phrase = "_ went to the _ and _ a _"; $replacer = array('George', 'store', 'bought', 'sandwich'); $var = transform($phrase, $replacer); echo $var; ?>
  10. If you made each blank different, you could use str_replace. You could number each blank like this _1_ went to the _2_ and _3_ a _4_ Then the code would look like this <?php $phrase = "_1_ went to the _2_ and _3_ a _4_"; $replace = array("_1_", "_2_", "_3_", "_4_"); $replacer = array('George', 'store', 'bought', 'sandwich'); $newphrase = str_replace($replace, $replacer, $phrase); echo $phrase; echo '<br>'.$newphrase; ?>
  11. How do you have a login/register on your site without a database? Well...I'm not sure if there is that much you can do in your situation without a database. I would suggest looking at your host seeing if you can upgrade to be able to have one. It would be pretty difficult using a text file for your search.
  12. Does your host support PHP at least?
  13. Yeah, your going to need a database for this. Are you able to have a database with your hosting?
  14. You will want to use LIKE in your query, so something like this SELECT * FROM table WHERE keywords LIKE '%$keyword%'
  15. Okay...your saying if your URL looks like "'/naz/test.php" you want it to say "its working!". But when you click the link, your URL is going to look like "/naz/test.php?url=yes"...so that IF statement will never be true.
  16. Which means it will never be called, think about it. Ah, your right.
  17. No problem. Now you can see why I was so hesitant to help in the beginning. Pagination is like my pet peeve. I guess now it won't be Well...goodnight.
  18. Finally! It should be fine now. Na, I don't hate you for it. If anything, it made me better. Now I could probably code pagination without looking at any outside resources...blindfolded xP hah. Don't forget to press "topic solved". It should feel good to press it after 100+ posts. And yes, you should be able to change limit to anything you want and it will work.
  19. Okay...this is like my last hope <?php $username = $_SESSION['username']; $limit = 10; $query_count = "SELECT count(*) FROM goldies WHERE Sender='$username'"; $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 goldies WHERE Sender='$username' LIMIT $offset,10"; 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!"); } //Create the table of output data echo "<table>\n"; while ($row = mysql_fetch_array($result)) { //Alternate the row background color $bgcolor = ($bgcolor == "#737373")?'#737373':'#737373'; //Display the row of data echo "<tr bgcolor=\"$bgcolor\">\n"; echo " <td>".$row["Receiver"]."</td>\n"; echo " <td>".$row["Amount"]."</td>\n"; echo " <td>".$row["Date"]."</td>\n"; echo "</tr>"; } echo "</table>\n"; //Enable the Prev link if not first page if ($page > 1) { echo("<a href=\"creditshistory.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=\"creditshistory.php?page=$i\">$i</a> "; } } //Enable the Next link if not last page if ($page < $numofpages) { echo("<a href=\"creditshistory.php?page=".($page+1)."\">NEXT</a>"); } else { echo("NEXT"); } ?>
  20. -shakes head- Try this <?php $username = $_SESSION['username']; $limit = 10; $query_count = "SELECT count(*) FROM goldies WHERE Sender='$username'"; $result_count = mysql_query($query_count) or die("Error: " . mysql_error()); $totalrows = mysql_result($result_count, 0, 0); $numofpages = ceil($totalrows/$limit); $rowsperpage = $totalrows/$numofpages; if (isset($_GET['page'])) $page = $_GET['page']; else $page = 1; $offset = ($page - 1) * $rowsperpage; $query = "SELECT * FROM goldies WHERE Sender='$username' LIMIT $offset,10"; 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!"); } //Create the table of output data echo "<table>\n"; while ($row = mysql_fetch_array($result)) { //Alternate the row background color $bgcolor = ($bgcolor == "#737373")?'#737373':'#737373'; //Display the row of data echo "<tr bgcolor=\"$bgcolor\">\n"; echo " <td>".$row["Receiver"]."</td>\n"; echo " <td>".$row["Amount"]."</td>\n"; echo " <td>".$row["Date"]."</td>\n"; echo "</tr>"; } echo "</table>\n"; //Enable the Prev link if not first page if ($page > 1) { echo("<a href=\"creditshistory.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=\"creditshistory.php?page=$i\">$i</a> "; } } //Enable the Next link if not last page if ($page < $numofpages) { echo("<a href=\"creditshistory.php?page=".($page+1)."\">NEXT</a>"); } else { echo("NEXT"); } ?>
  21. Okay, hopefully this is right now. <?php $username = $_SESSION['username']; $limit = 10; $query_count = "SELECT count(*) FROM goldies WHERE Sender='$username'"; $result_count = mysql_query($query_count) or die("Error: " . mysql_error()); $totalrows = mysql_result($result_count, 0, 0); $numofpages = ceil($totalrows/$limit); $rowsperpage = ceil($totalrows/$numofpages); if (isset($_GET['page'])) $page = $_GET['page']; else $page = 1; $offset = ($page - 1) * $rowsperpage; $query = "SELECT * FROM goldies WHERE Sender='$username' LIMIT $offset,10"; 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!"); } //Create the table of output data echo "<table>\n"; while ($row = mysql_fetch_array($result)) { //Alternate the row background color $bgcolor = ($bgcolor == "#737373")?'#737373':'#737373'; //Display the row of data echo "<tr bgcolor=\"$bgcolor\">\n"; echo " <td>".$row["Receiver"]."</td>\n"; echo " <td>".$row["Amount"]."</td>\n"; echo " <td>".$row["Date"]."</td>\n"; echo "</tr>"; } echo "</table>\n"; //Enable the Prev link if not first page if ($page > 1) { echo("<a href=\"creditshistory.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=\"creditshistory.php?page=$i\">$i</a> "; } } //Enable the Next link if not last page if ($page < $numofpages) { echo("<a href=\"creditshistory.php?page=".($page+1)."\">NEXT</a>"); } else { echo("NEXT"); } ?>
  22. OMG, I gave you the wrong code now! hold on...
  23. I don't even know anymore...my brain went to poo from all this thinking Did the code work for you?
  24. A session isn't going to start unless you actually register one. session_start() doesn't "create" any sessions. So calling session_start on your header page isn't a bad thing. If you really want to do that, just do this <?php if (!empty($_SESSION)) session_start(); ?> Now session_start will only be called if the user has a registered session.
×
×
  • 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.