-
Posts
1,216 -
Joined
-
Last visited
Everything posted by WebStyles
-
checkbox with multiple values processing into MySql
WebStyles replied to rilana's topic in PHP Coding Help
did you even read what I said 2 posts ago? you are sending over an array, therefor, when you grab the value, you are actually grabbing an entire array. You DO NOT want to explode() an array, that would just be silly, since explode creates an array from a string. Print out the array: echo '<pre>'; print_r($_POST['beruf']); echo '</pre>'; -
editing site content - where is content located?
WebStyles replied to jfenley's topic in PHP Coding Help
What kind of websites are we talking about? is it like a blog, where there bound to be a minimal set of database fields, like date, time, title, text, etc... or something like an online store that has shopping carts and whatnot? If it's the first type, it shouldn't be too hard for you to find the correct tables in phpmyadmin and be able to change the content. -
editing site content - where is content located?
WebStyles replied to jfenley's topic in PHP Coding Help
search through your files to see if there's anything resembling mysql_query, mysql_connect... anything that says mysql really. If you have that, it means content is on a database, try accessing www.yourdomain.com/cpanel then login and look for phpmyadmin (it's worth a try). if you have cpanel, then you'll have phpmyadmin that will allow you to see the databases and their content. hope this helps -
at a (very) quick glance, (sorry, I'm in a hurry) change if (mail($mailto, $subject, '', $header)) { to if (mail($mailto, $subject, $message, $header)) { so message gets sent.
-
ah! you edited it out
-
Fixing Redixx code: $string = ''; foreach ($_POST as $key => $value) { $string .= $key." = '".mysql_real_escape_string($value)."', "; // removed ] after $key } $string = rtrim($string, ', ');
-
Newbie with stupid question about DATETIME...I know.
WebStyles replied to Bminor's topic in PHP Coding Help
lol. Right track! -
do you mean you wish to dynamically create the query string based on whatever is posted? (assuming that $_POST[$key] has the same name as your database fields) ? $string = ''; foreach ($_POST as $key => $value) { $string .= $_POST[$key] ." = '".addslashes($value)."', "; } then you'll just need to strip the last comma off the string.
-
calculate the remaining time with a simple substraction. then use an IF statement to check if it's greater or smaller than 7 days (in seconds) which would be 60*60*24*7 (seconds * minutes * hours * days) so something like: if(strtotime($row['note_end_date']) > time()){ // date hasn't expired yet, so we check the remaining days $diff = time() - strtotime($row['note_end_date']); if($diff <= (60*60*24*7) ){ $bgColors = '#CC6600'; }else{ $bgColors = '#99FF99'; } }else{ // date has expired $bgColors = '#FF3333'; } hope this helps
-
According to php.net manual, variables names must start with a letter or an underscore, not a number, so $1 and $2 are invalid. $pdf->Image('http://www.website.com/frames/' . $a . '.' . $b . 'L.jpg', '20', '70', '', '60');
-
having a bit of a challenge rearranging things properly...
WebStyles replied to seetheworldsecond's topic in PHP Coding Help
There's gotta be something else wrong. My code simply creates a new array and populates it with values you already had in other variables. the error is somewhere else. Did you replace the API Key in your string? (the one you posted was removed for obvious reasons) Did you change ANYTHING in the api calls ? Go back to your code before you added my changes, and test again, then add the changes carefully, testing after adding each line, until you figure out where the error is. -
@TeNDoLLA: No, that's not it, they're sent to different email addresses. I still haven't figured it out though... I know this sounds really stupid, but just to be sure: Maybe you're using your email to test, so you get the copy too??? EDIT: Yep, Basically the same as Maq said.
-
this is untested, just off the top of my head... but try it out. Maybe it'll work... lol <table border="1"> <tr> <th>Your Postcode</th> <th>Destination</th> <th>Distance</th> </tr> <?php $start=$_GET["enter"]; $ends = array(); //finds value from database field $result = mysql_query("SELECT * FROM `cars`"); while($row = mysql_fetch_array($result)){ $ends[]=$row['Location']; } // Postcode enterd via input form $result=mysql_query("SELECT * FROM postcodes WHERE Pcode='$start'"); while($row=mysql_fetch_array($result)){ $gridn[0]=$row['Grid_N']; $gride[0]=$row['Grid_E']; } foreach($ends as $fin){ // Postcodes within table $result=mysql_query("SELECT * FROM postcodes WHERE Pcode='$fin'"); while($row=mysql_fetch_array($result)){ $gridn[1]=$row['Grid_N']; $gride[1]=$row['Grid_E']; } // TAKE GRID REFS FROM EACH OTHER. $distance_n=$gridn[0]-$gridn[1]; $distance_e=$gride[0]-$gride[1]; // CALCULATE THE DISTANCE BETWEEN THE TWO POINTS $hypot=sqrt(($distance_n*$distance_n)+($distance_e*$distance_e))/1.609; echo '<tr> <td>'.$start.'</td> <td>'.$fin.'</td> <td>'.round($hypot/1000,2).' Miles</td> </tr>'; } ?> </table>
-
Was doing sort of the same, but TeNDoLLA beat me to it. I prefer to grab the database stuff firts, and then loop through it and add formatting or whatever. (you need to add the database fields) <?php $results = array(); while ($query_result = mysql_fetch_array($query)) { $results[] = $query_result; } $count = 0; echo '<table><tr>'; foreach ($results as $val){ $count++; if($count % 3 === 0) echo '</tr><tr>'; echo '<td nowrap="nowrap">'.$val.'</td>'; } echo '</tr></table>'; ?>
-
How would you like that? with just text and spaces, or with an html table? (what fields does $query_result return?)
-
hmmm... forgot about that detail cause I tested on 'localhost'... Thanks Fugix. Maybe you'll want to use strpos() to check the names, since visitors might or might not include the www., or use str_replace("www.","",$url); to remove it... or something.
-
here's a simplified version, I'm sure you can figure out the rest from here: <html><head> <?php //BEGIN IF ELSE STATEMENT $url = $_SERVER["SERVER_NAME"]; $site = ''; if ($url == 'specialpizza.com') $site = 'Special Pizza'; if ($url == 'mainstreetspecialpizza.com') $site = 'Main Street Pizza'; if ($url == 'elmstreetspecialpizza.com') $site = 'Elm Street Pizza'; ?> <title><?php echo $site; ?></title> </head> <body> <h1>Welcome to <?php echo $url; ?></h1> <p>Text text text text text text text text text text text text text text text <?php echo $site; ?> text text text text text text </p> </body> </html>
-
having a bit of a challenge rearranging things properly...
WebStyles replied to seetheworldsecond's topic in PHP Coding Help
ok, try somthing like this: right after $Resp = simplexml_load_file($apicallb); (around line 40) add: $itemID_and_quantity = array(); (just to start a new empty array)... then inside your results loop (around line 48) where you have foreach($Resp->Item as $item2) { $qsold = $item2->QuantitySold; $itemsid4quantitysold = $item2->ItemID; add: $itemID_and_quantity[$itemsid4quantitysold] = $qsold; so it will now look like this: foreach($Resp->Item as $item2) { $qsold = $item2->QuantitySold; $itemsid4quantitysold = $item2->ItemID; $itemID_and_quantity[$itemsid4quantitysold] = $qsold; then at the bottom, where you want to display it (around line 92/93) where you have: <div id=\"bottomhalf\"> <img src=\"itemswatched.jpg\" width=\"36\" height=\"31\" /> <span class=\"black2\">Items Watched by:<b>$watchcount</b> people. Items Sold:$qsold </span><img src=\"money.jpg\" width=\"50\" height=\"30\" /> <span class=\"black2\">Price:</span>$1.49 <br />Iditem:$itemids5 </div> replace $qsold with: {$itemID_and_quantity[$itemsid5]} <div id=\"bottomhalf\"> <img src=\"itemswatched.jpg\" width=\"36\" height=\"31\" /> <span class=\"black2\">Items Watched by:<b>$watchcount</b> people. Items Sold:{$itemID_and_quantity[$itemsid5]} </span><img src=\"money.jpg\" width=\"50\" height=\"30\" /> <span class=\"black2\">Price:</span>$1.49 <br />Iditem:$itemids5 </div> if the ids are the same, this should work. -
having a bit of a challenge rearranging things properly...
WebStyles replied to seetheworldsecond's topic in PHP Coding Help
why not just build an array like $array[$itemid]=$quantity; when you first loop through the quantities, then you can use it later to display them. -
Cool. Glad I could help.
-
having a bit of a challenge rearranging things properly...
WebStyles replied to seetheworldsecond's topic in PHP Coding Help
at a quick glance, you don't seem to be grabbing the quantity. where you have this: $link = $item->ViewItemURLForNaturalSearch; $title = $item->Title; $watchcount = $item->WatchCount; $image = $item->GalleryURL; $itemids5 = $item->ItemID; try adding: $qsold = $item->QuantitySold; -
Putting dynamic menu results back into database
WebStyles replied to davidcriniti's topic in PHP Coding Help
so you just changed the <select> name to 'athlete_id' and it worked? that probably means you already have an element somewhere called 'id' that was conflicting with your <select> -
I'm not sure I get what you need. You want a function to return the current day, plus the next 6 days? function createDatesArray($days) { $output = array(); $today = date("l jS M"); for($i=0; $i<$days; $i++){ $output[] = date('l jS M',strtotime("$today + $i days")); } return $output; } why would you want monday to be index 1 if monday is the last day? I don't really get it, then your dates would not be in the correct order... why not just use: function createDatesArray($days) { $output = array(); $today = date("l jS M"); for($i=0; $i<$days; $i++){ $wday = date('l',strtotime("$today + $i days")); $output[$wday] = date('l jS M',strtotime("$today + $i days")); } return $output; } now monday will be index 'Monday', and tuesday will be index 'Tuesday' etc....
-
checkbox with multiple values processing into MySql
WebStyles replied to rilana's topic in PHP Coding Help
there's nothing wrong with having the array... you can grab each one with: $beruf1 = strip_tags($_POST['beruf'][0]); $beruf2 = strip_tags($_POST['beruf'][1]); $beruf3 = strip_tags($_POST['beruf'][2]); of just do: foreach($_POST['beruf'] as $val){ echo '<br />'.strip_tags($val); } -
Need help with function date() and strtotime()
WebStyles replied to JuanKiller69's topic in PHP Coding Help
even your first date is incorrect. strtotime is looking for the month in the wrong field, and 15 is an invalid month so you get an incorrect date. you first date is 9th May 2011, but you're inserting 5th September 2011. (i.e. day and month are switched) try splitting it manually: $date1 = explode("/",$record[8]); $realdate1 = $date1[2].'-'.$date1[1].'-'.$date1[0]; $date2 = explode("/",$record[9]); $realdate2 = $date2[2].'-'.$date2[1].'-'.$date2[0];