wildteen88
Staff Alumni-
Posts
10,480 -
Joined
-
Last visited
Never
Everything posted by wildteen88
-
These lines are not needed <FilesMatch \.php$> SetHandler application/x-httpd-php </FilesMatch> Loadfile "C:/PHP/php5ts.dll" Remove them. Make sure you have restarted Apache after making any changes to the httpd.conf. You should also add PHP to the PATH Environment Variable. Do not configure the php.ini until Apache/PHP are working.
-
Have you place session_start in update.php?
-
Make sure you're calling session_start at the top of any page that uses sessions.
-
Your code should be
-
How are you storing your passwords in your database? Are you encrypting them, eg MD5, SHA1 etc? If you are storing your password in an encrypted form you'll also need to encrypt the password being placed within your query
-
Yes that is possible. However do note that you can perform more than one insert within a single query. This will be much more efficient: if($file_len > 0) { // start query $sql = 'INSERT INTO `upload_images` (`image_name`, `img_size`, `img_medium`, `img_title`, `page_name`, `bio_link`, `img_url`, ) VALUES '; // generate the rest of the query for($s=0; $s < $file_len; $s++) { $sql .= " ('$image_name[$s]', '$sizes[$s]', '$mediums[$s]', '$titles[$s]', '$page_name', '$bio_link', '$img_url'),"; } // remove ending comma $sql = substr($sql, 0, -1); if(mysql_query($sql)) { echo "Inserted " . count($file_len) . " files successfully"; } else { die( "ERROR! Unable insert files<br />" . mysql_error() ); } } You should also be sanitizing your variables that you use within your queries too.
-
The picture you posted is a screenshot of the variables and server settings page from phpMyAdmin. phpMyAdmin provides a web based interface for managing MySQL databases. You cannot change MySQL's configuration from within phpMyAdmin. To change MySQL's configuration you'll need to edit the my.ini config file. What are you wanting to change?
-
mysql_query is returning false, which means there is a problem with your query. Change $result = mysql_query($sql); to $result = mysql_query($sql) or trigger_error(mysql_error()); Post the error message that is given?
-
Checking mysql_num_rows result with if statement
wildteen88 replied to DarkPrince2005's topic in PHP Coding Help
Not telling us - what you're trying to do - what your code is supposed to do - what is the error(s) you're getting -
Yes that is that basically all you need to add to the httpd.conf configure Apache with PHP. I would recommend you to PHP to the PATH Environment Variable too. You'll now need to rename the file php.ini-recommended to php.ini within your PHP installation folder.
-
Argh you have used the installer to install PHP. Do not use the installer, uninstall PHP. Go to php.net and download the PHP Zip package instead. Extract the Zip and configure PHP and Apache manually.
-
In this example how does $quote get assigned it's value?
wildteen88 replied to Canadian's topic in PHP Coding Help
$quote will contain an array of matches. All is explain in the manual for eregi. -
There many functions available which can manipulate text. But wouldn't it be easier if you changed the format of your url to something like mydomain/rotator/?kw={SEARCHTEXT}&pid={PARTNERID} Now your keyword and partnerid will be completely separate variables, you'd get the keyword using $_GET['kw'] and the partnerid using $_GET['pid']
-
You should be using mysql_num_rows to check if your query returned any results.
-
You'd be better of doing this, otherwise you're just repeating yourself. $prev_med_name = null; while($row = mysql_fetch_assoc ($result)) { $med_name = ($prev_med_name != $row['med']) ? $row['med'] : ' '; echo '<tr> <td>'.$med_name.'</td> <td>'.$row['dose'].'</td> <td>'.date("m/d/y ", strtotime($row['startdate'])).'</td> </tr>'; $prev_med_name = $row['med']; }
-
file_get_contents will just return the contents of a file being read as plain text. It wont parse the PHP code within the file being read.
-
Use strtotime combined with the date function $time= strtotime("+1 month"); echo 'Current month: ' . date('F') . '<br />'; echo 'Next month: ' . date('F', $time) . '<br />';
-
how do I write to the end of the first line of a flat text file
wildteen88 replied to husslela03's topic in PHP Coding Help
What version of PHP are you using? run phpversion or phpinfo to find out. -
To add the product_id and quantity to your $parameters array you could do it like this // define the array first $parameters = array('ip'=>'92.xxx.xx.xxx', 'sid'=>'9fe512105552ebfe963a98684a8daaa0', 'lang'=>'us', 'shipping_method_id'=>'1', 'wm'=>'3000', 'tr'=>'8027', 'pr'=>'11', 'site_id'=>'8027', 'nocustom'=>'', 'host'=>'site.com', 'referrer'=>'http://www.site.com/checkout.php', 'query'=>'', 'free_ship_method_id'=>'0', 'usa_euros'=>'0', 'use_pounds'=>'0', 'tmpl'=>'157', 'currency'=>'USD', 'version'=>'2.50', '3456'='4' ); // query the database $q = "SELECT * FROM `fhp_orders` WHERE `customer_id`='$cusID'"; $r = mysql_query($q) or die (mysql_error()); while ($a = mysql_fetch_array($r)) { // here the product id and quantity will be added to the array $parameters[ $a['product_id'] ] = $a['quantity']; } echo "<pre>".print_r($parameters, true)."</pre>";
-
how do I write to the end of the first line of a flat text file
wildteen88 replied to husslela03's topic in PHP Coding Help
Yes you can use the file function to grab the contents of each line into an array. But you wouldn't need to use a loop to append some text to the first line. You'd use $var[0] eg $contents = file('filename.txt'); // append something to Line 1 $content[0] .= " whatever you want to put here"; Now to save the changes you'd use // convert the array to a string using implode() $text = implode($content); // rewrite the file file_put_contents("filename.txt", $text); -
This line $fraction02[$i] = array(); Should of been place in the first for loop. Eg for($i = 1; $i < $multiplier; $i++){ $fraction02[$i] = array(); for($j = 0; $j < $multiplier; $j++){
-
If you're going to be using regex then str_replace() is not the function you want, as it doesn't support regex. You'll need to use preg_replace instead.
-
Change your code to $contents = file_get_contents('mydata.txt'); echo '<pre>' . $contents . '</pre>'; The reason why your spaces are not showing is because web browsers ignore any whitespace. I added the pre tags which forces the browser to display the spaces.
-
That code is fine. It will display the contents of the file being read. What issue are you having with that code?