Jump to content

Philip

Staff Alumni
  • Posts

    4,665
  • Joined

  • Last visited

  • Days Won

    20

Everything posted by Philip

  1. '$logged[username]' = 'username' should be `username` = '$logged[username]' column names are always surrounded by backticks (`) and values by single quotes (')
  2. It's because it returns an array item for each instance of the blocks. So $result = countLines($string); if(isset($result[0]) echo $result[0]; // the above line will show how many lines in the first [code] block if(isset($result[1]) echo $result[1]; // this one shows the second, if it exists... etc.[/code]
  3. Post your full code, not just // some php Something in that some php it whats causing your error most likely.
  4. A few ways: echo 'Hello, ' .$_SESSION['username']. 'it is ' .date('F j, Y'). 'and the time is ' .date('H:i:s'); echo 'Hello, ',$_SESSION['username'],'it is ',date('F j, Y'),'and the time is ',date('H:i:s'); echo "Hello, {$_SESSION['username']} it is ".date('F j, Y')."and the time is ".date('H:i:s');
  5. You need to make sure to escape the quotes, <?php $EmailFrom = "matthewdipalma@gmail.com"; $EmailTo = "matthew0dipalma@gmail.com"; $Subject = "FORM"; $Name = Trim(stripslashes($_POST['Name'])); $Filename = Trim(stripslashes($_POST['Filename'])); $OtherInformation = Trim(stripslashes($_POST['OtherInformation'])); $validationOK=true; if (!$validationOK) { print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">"; exit; } $Body .= "Name: "; $Body .= $Name; $Body .= "n"; $Body .= "Filename: "; $Body .= $Filename; $Body .= "n"; $Body .= "OtherInformation: "; $Body .= $OtherInformation; $Body .= "n"; $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>"); if ($success){ print "<meta http-equiv=\"refresh\" content=\"0;URL=ok.htm\">"; } else{ print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">"; } ?> You could also do: <?php $EmailFrom = "matthewdipalma@gmail.com"; $EmailTo = "matthew0dipalma@gmail.com"; $Subject = "FORM"; $Name = Trim(stripslashes($_POST['Name'])); $Filename = Trim(stripslashes($_POST['Filename'])); $OtherInformation = Trim(stripslashes($_POST['OtherInformation'])); $validationOK=true; if (!$validationOK) { print '<meta http-equiv="refresh" content="0;URL=error.htm">'; exit; } $Body .= "Name: "; $Body .= $Name; $Body .= "n"; $Body .= "Filename: "; $Body .= $Filename; $Body .= "n"; $Body .= "OtherInformation: "; $Body .= $OtherInformation; $Body .= "n"; $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>"); if ($success){ print '<meta http-equiv="refresh" content="0;URL=ok.htm">'; } else{ print '<meta http-equiv="refresh" content="0;URL=error.htm">'; } ?>
  6. The column 'Book' does not exist in your table, TEST1_contacts, on this line: $query="SELECT * FROM TEST1_contacts WHERE 'Book' LIKE '%$search%'";
  7. include('usernamepassworddatabase.php'); You need quotes - and make sure that is the correct path to the file
  8. I have to agree with CV on this one. Honestly, I've learned more here by helping than by asking questions. Maybe it's just me, but when someone asks a question and I don't know the answer I'll either go and try to solve it, or see what the reply is and try it myself. If you're going with a certification - w3schools is known, but for beginner stuff, not for the advanced like zend. (IMO) When don't you toot your horn
  9. $result = mysql_query($query) or die(mysql_error()); // run query $array = array(); // setup array while($row = mysql_fetch_assoc($result)) { $array[] = $row['col1'].' '.$row['col2']; // set whatever variables you are calling, you can also output here while you are at it } $storeInFile = implode('"\n", $array); // implode array to a single string fwrite($fp,$storeInFile); // write to file Something like that? edit: missing a variable, oops
  10. I'm voting on the second one, with the guy facing you. As said, it's more personal as if he's inviting you in to watch the video. I think the flag should be a bit brighter though, but not overwhelming.
  11. Or just implode() <?php if(is_array($_POST['propExterior'])) $propExterior = implode(', ',$_POST['propExterior']); else $propExterior = $_POST['propExterior']; echo $propExterior ?>
  12. You need to either pass $var as a parameter, or call it as global: $var = new foo(); function random($var){ echo $var->myFunc(); } random($var); or $var = new foo(); function random(){ global $var; echo $var->myFunc(); } random();
  13. It doesnt know which table to update.
  14. Correct, but when you call: $result = mysql_fetch_array($result); It'll return 1 row result, not a multi-dimension array of the results.
  15. So, the queries are exactly the same?
  16. I'm aware that you have data in there, but I'm more concerned about the query itself. When you are getting different results, are your queries the exact same every time? edit: sorry, I just realized that I put print_r in there. it's just habit to put in print_r when debugging mysql queries/results
  17. Are you sure the name of the column is "name" and not "Name" or something else? while($row=mysql_fetch_array($result)) { if ($id == $end) { break; } $id++; echo '<pre>'; print_r($row); echo '</pre>'; /*$id = $row["id"]; $email = $row["email"]; $name = $row["name"]; echo "<tr class=TableFields><td>$email<td>$name</td>"; echo "<td class=LinkText align=center><a href=newsmailerlist.php?action=2&email=$email>Edit</a></td>"; echo "<td class=LinkText align=center><a href=newsmailerlist.php?action=3&email=$email>Delete</a></td>";*/ } The code above will show you what the proper array keys are.
  18. Change: $result = mysql_query($q, $con); to $result = mysql_query($q, $con) or die(mysql_error()); You should put the or die on the query, not the fetch. BTW - I believe your loop logic is incorrect. Fetch array will return 1 row at a time, what you're doing is calling the array keys -- which turns out to be different column for one row.
  19. Adding to this, are you sure the query is the exact same every time? $q = "SELECT * FROM members WHERE screenname = '$sname' "; echo $q; $result = mysql_query($q) or die(mysql_error()); $row1 = mysql_fetch_row( $result ); // the following will output the data returned from the fetch_row - showing the key names, etc echo '<pre>'; print_r($row1); echo '</pre>';
  20. It's because if ($_GET['content_id']="") should be: if ($_GET['content_id'] == "")
  21. echo $_POST['Mortgage']... you might be calling the wrong field name from the form If it doesn't echo anything, then add this above $budg_mortgage = $_POST['Mortgage']; echo '<pre>'; print_r($_POST); echo '</pre>';
  22. Just as Mark stated earlier about an array, this site has an example code that is similar to what you are wanting: http://20bits.com/articles/random-weighted-elements-in-php/ However, I think the following would be easiest
  23. If I remember correctly, if you don't have a logo in there it'll default to the name of your forum. However, on the newer versions, the smf logo (Simple Machines Forum + fulcrum) is under Themes/default/images/smflogo.gif
  24. $query = "UPDATE `$tbl_name` SET `amount` = `$budg_mortgage` WHERE `sub-category` = 'Mortgage'"; should be: $query = "UPDATE `$tbl_name` SET `amount` = '$budg_mortgage' WHERE `sub-category` = 'Mortgage'"; ` are for column names, ' are for values (see change @ $budg_mortgage)
  25. That's correct
×
×
  • 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.