wildteen88
Staff Alumni-
Posts
10,480 -
Joined
-
Last visited
Never
Everything posted by wildteen88
-
CANT YOU SEE WHERE IM GOING WRONG ANYONE?? HELP PLEASE
wildteen88 replied to jigsawsoul's topic in PHP Coding Help
DOH! I didn't read your query properly. INSERT statements do not have a WHERE clause. Are you inserting a new record or are you wanting to update an existing record? For updating existing records you should use an UPDATE query. -
CANT YOU SEE WHERE IM GOING WRONG ANYONE?? HELP PLEASE
wildteen88 replied to jigsawsoul's topic in PHP Coding Help
No, but to see if your query is failing due to an error use mysql_error. -
To move the decimal place by one multiply by 10 echo (309 / 397) * 10; 7.78% is not smaller than 0.778%
-
Need to see more code than that. Where is you form?
-
variable variables and or array of arrays
wildteen88 replied to kevin nally's topic in PHP Coding Help
Change $newArray = to $newArray[] = You will also want to add $newArray = array(); before the for loop -
You have an extra ( at the start of your statement
-
The use of isset is incorrect here if (isset($_POST['regname']) | $_POST['regstate'] | $_POST['regcity'] | $_POST['regemail'] | $_POST['username'] | $_POST['password'] | $_POST['confirmpass'])) You should read up on the proper use of isset. Your not listing your variables properly, you should separate each variable with a coma not a pipe character. Also statements which span multiple lines must be wrapped in curly braces {}. Read up on the use of if
-
You have an extra comma at the end of your query Remove that and the error will be resolved. However you should not place raw _POST data into your query, as you'll be prone to SQL injection attacks. You should pass your _POST variables through to mysql_real_escape_string to help prevent such attacks.
-
What was the full error? There is nothing wrong with the first three lines of PHP code that you said was causing an error. However this is in correct syntax. You should place a semi-colon after the if. if (!$con); That will cause an error or a blank screen. I think the error you saw was a MySQL error not a PHP error. Remove the semi colon from the if statement and post the error message you get in full.
-
You're not processing your query correctly. When processing MySQL queries you need to pass them to the mysql_query function first. You'd then pass the result to one of the mysql_fetch_* functions, eg mysql_fetch_assoc
-
Use > instead of > and < instead of <
-
To get your results from your query you need to use ond of the mysql_fetch_* functions, such as mysql_fetch_assoc. This function will return each row as an associative array $query = "SELECT SUM(total) FROM account"; $result = mysql_query($query); while($row = mysql_fetch_assoc($result)) { echo $row['SUM(total)']; }
-
PHP files wont open in the internet anymore?
wildteen88 replied to eazyefolife's topic in PHP Installation and Configuration
Something must of changed with the configuration of your HTTP server. How have you configured your HTTP server with PHP? -
If you're using MySQL database then you can calculate this within your query using the MySQL SUM() function, example usage can be found here
-
PHP cannot identify forms by their ids. You'll want to give your submit buttons unique names, for example name your submit buttons like form1_submit, form2_submit etc. Now to see which form has been submitted use if(isset($_POST['form1_submit'])) { // code for form1 here } elseif(isset($_POST['form2_submit'])) { // code for form2 here } etc
-
You can use strtotime to convert your mysql timestamp into a unix timestamp. Using the unix timstamp you can pass this into the secound parameter for the date function to reformatted your date. Example $mysqlTimestamp = '2010-01-19 17:01:11'; $unixTimestamp = strtotime($mysqlTimestamp); echo date('l jS Y h:i:s a', $unixTimestamp);
-
You don't use $_GET, you use the actual variable name $id To learn more about include read up on the manual http://php.net/manual/en/function.include.php
-
Have a read of this article http://www.phpfreaks.com/tutorial/working-with-dates-in-php
-
Correct way is if ($_SESSION['trackBrowsing'] != "value01" || $_SESSION['trackBrowsing'] != "value02"){
-
Move this block of code function parseString( $start, $end, $string ) { $before = explode( $start, $string ); $return = explode( $end, $before[1] ); return $return[0]; } Outside of your function_name() function declaration
-
You need to be setting the content type header("Content-type: image/png"); On the first line of head.php and body.php You'd display your images like so <?php echo"<img src='head.php' /> <br /> <img src='body.php' />"; ?>
-
You could just use exec with the following command, eg exec('cp -r /path/to/xxx/folder /path/to/zzz/folder') However the above will only work for *nix based systems. Alternatively you can create a recursive function, such as the one posted in the user submitted comments for the copy function.
-
You'll want to use $votes = $userinfo['votes']; after this line $userinfo = mysql_fetch_array($result); //put friends row into an array $userinfo
-
I cant tell from just those two snippets. Where is the variable $votes originally defined? Can I see more code. EDIT: Ignore