-
Posts
2,965 -
Joined
-
Last visited
Everything posted by mikesta707
-
none of the else statements show up at all? I don't see how thats possible. do you get an error? make sure you turn error reporting on
-
PHP Form Action Self...not working on one server
mikesta707 replied to slawrence10's topic in PHP Coding Help
hmm blank page? can I see the code for the processing page? -
there are code tags you should put code in by the way if (($_POST["f_name"] == "") || (($_POST["l_name"] == "") || (($_POST["tel_number"] == "") || (($_POST["email"] == "") { should be if (($_POST["f_name"] == "") || (($_POST["l_name"] == "") || (($_POST["tel_number"] == "") || (($_POST["email"] == "")) { simple syntax error. missing a closing ')' at the end of the if statement
-
[SOLVED] having trouble with server side validation
mikesta707 replied to cdc515's topic in PHP Coding Help
hmm, you gonna have to post more code than that (PHP would probably be fitting in a PHP board) Because the only that would reset your fields on the page you submit them is javascript and a html reset button. -
Displaying Values of an Array in Table
mikesta707 replied to surajkandukuri's topic in PHP Coding Help
are the lengths the same? and are they numeric? if so you can do something like echo "<table>" for ($i = 0; $i < count($firstarray); $i++){ echo "<tr>"; echo "<td>".$firstarray[$i]."</td>"; echo "<td>".$secondarray[$i]."</td>"; echo "<td>".$thirdarray[$i]."</td>"; echo "</tr>"; } echo "</table>"; -
PHP Form Action Self...not working on one server
mikesta707 replied to slawrence10's topic in PHP Coding Help
if you don't set an action, it will automatically submit to itself. You can use this instead -
Ahh yeah my bad, try using $_SERVER["HTTP_HOST"] instead. that will give you your domain name, IE www.example.com/
-
you have to use one of PHP's mysql_fetch_xxxx to get the results from your query include 'dbc.php'; $result = mysql_query("SELECT sum(record_amount) as total_expense from record"); $row = mysql_fetch_assoc($result); echo $ow['total_expense']; Edit: beat me to it
-
first of all, this $usr=user($_GET["id"]); is invalid, because user() isn't even a function. it seems you wanted to make a function to get the username with this function function name($name) { global $db_id; $query="select count(*) from users where name='".$name."'"; $result=mysql_query($query, $db_id); $row=mysql_fetch_row($result); return (bool)$row[0];; } but there are alot things wrong with this... firstly, if you want to get the username from a query, you have to select the username. secondly, you should probably return the username. What is $_GET['id']? is name the column in your users table with the username? your function should probably look something like this function name($name) { global $db_id; $query="select username from users where name='".$name."'"; $result=mysql_query($query, $db_id); $row=mysql_fetch_assoc($result); return $row['username']; } but if you are using the username in your site in enough places to warrant making a function to get the username, why not just store the username in a session variable?
-
indeed. Without seeing any code though, I can't be of much help
-
[SOLVED] bcc in multipart email causing grief
mikesta707 replied to cactuscake's topic in PHP Coding Help
well firstly, your headers should start like this $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; the \r\n is there to satisfy the RFC 2822 internet mail standard. \n does not satisfy the RFC2822 standard, so its not valid -
<a href="<?php echo $_SERVER['DOCUMENT_ROOT']; ?>/admin"> admin</a> $server['document_root'] has the address of the root directory in your server. I don't remember if the value comes with a slash at the end or not, so you may have to get rid of that slash
-
please put your code in code or php tags tags. As for your problem... you haven't really specified what it was. Is it not displaying the path? what is happening and what do you expect to happen
-
[SOLVED] bcc in multipart email causing grief
mikesta707 replied to cactuscake's topic in PHP Coding Help
taken straight from the PHP manual $headers .= 'To: Mary <mary@example.com>, Kelly <kelly@example.com>' . "\r\n"; $headers .= 'From: Birthday Reminder <birthday@example.com>' . "\r\n"; $headers .= 'Cc: birthdayarchive@example.com' . "\r\n"; $headers .= 'Bcc: birthdaycheck@example.com' . "\r\n";//this is probably what you want to pay attention to is that what you put? it it all different? How did you add it in there? -
Indeed, but if each row had a zip code column, that task would be pretty easy. depending, of course, on how your zip code search engine works
-
You mean besides him mentioning how he is "...still new to cron jobs but will have to figure out how to set them up to draw the numbers every hour" in his original post? I have no clue. Why would somone use cron jobs on lottery script if user input's to win.. lol Or set time in php to draw it every x minutes.... umm... in real life lotteries work on a "cron-job" like system. The winning numbers are drawn every x amount of time. the fact that the post had the word lottery system should have given it away... not to mention thats what OP asked for
-
I don't really get what you mean when you say "force them to be a user" but as I understand from your first post you are having a problem with the session variable. make sure you have session_start() at the beginning of the page. try doing a print_r on the session variable to see what it holds. also, try echoing the query to make sure it looks like it should. im not sure what you are trying to do with that function, but if you should return a boolean value, rather than a number function is_user2($name) { global $db_id; $query="select count(*) from users where name='".$name."'"; $result=mysql_query($query, $db_id); $row=mysql_fetch_row($result); return (bool)$row[0]; } PHP gets kind of freaky with boolean coercion and sometimes you have to use the identical operator (===) rather than the equality operator (==)
-
I would add a zip code column to the table with all the auctions, and in the query just retrieve all the rows of the specified type of auction, and in the correct zip code range
-
not tested, but this should work out $counter = 10; do { echo "There are $counter green bottles sitting on the wall"; $counter--; echo " and if one green bottle should accidentley fall there would be $counter green bottles sitting on the wall"; } while ($counter > 0);
-
one thing i noticed is you don't clean the Session name variable. it looks like you want to $name=($_SESSION["name"]); perhaps that should be $name=clear($_SESSION["name"]); I don't know if that would be causing the error though. try echoing session['name'] and see if it has what you expect it to have
-
since you already defined $hasError to false before any validation, this may not be what you want: if(isset($hasError)) header('Location: contacterror.html'); since regardless of whether or not there was an error, $hasError is always set perhaps you meant this if ($hasError){ header('Location: contacterror.html'); }
-
question about stripslashes and real_escape_string
mikesta707 replied to lJesterl's topic in PHP Coding Help
yes it will. array map takes every single entry in 1 array, and runs all of them through a function. in your case, you run them through the stripslashes or mysql_real_escape_string functions -
I think your User class is the bees knees but discussion about OOP aside, I think we scared OP away
-
if its valid json, than you can just use json_decode to turn it into a PHP variable, sort it however you like, and then re-encode it if you need to
-
first of all, java != javascript. second of all, you have to realize that javascript is client side, while PHP is server side. this means that javascript is executed by your browser, while PHP is executed by the web server. as such, it is easy to write javascript with PHP, you just have to do something like echo "<script type='text/javascript'> OpenWindow.document.write(\"".$NotWorking."\") </script>"; however, it is harder to get PHP values with javascript. you can make a hidden field with a PHP value, and access it via the HTML DOM that javascript has, for example <input type="hidden" id="phpVal" value="<?php echo $someValue; ?>" /> <script type="text/javascript" > phpval = document.getElementById('phpVal').value; </script> there are a couple of other ways, like with cookies. what exactly are you trying to do? perhaps there is an easier way