-
Posts
24,563 -
Joined
-
Last visited
-
Days Won
822
Everything posted by Barand
-
If you want mouse events and highlighting etc then you you could use that image as a background to an overlaying vector (SVG) image. This allows you you apply ids and classes to the vector objects (circles, circle segments, rectangles etc.) and use javascript as you would on other page elements.
-
Merging data from two multidimensional arrays
Barand replied to StevenTompkins's topic in PHP Coding Help
Do those two arrays come from two separate database queries? If so, you could/should use a joined query to get the array you want in the first place. -
I suggest you read the example on this page http://php.net/manual/en/features.file-upload.post-method.php and see how the $_FILES should be accessed
-
Which bit of that error message don't you understand?
-
With array_intersect() $testTwo = 'bakit ayaw po gumana paulit ulit bakit'; $testOne = 'bakit paulit ulit bakit ulit'; $arr1 = explode(' ', $testTwo); $arr2 = explode(' ', $testOne); $similarities = array_intersect($arr2,$arr1); foreach ($similarities as $s ) echo "$s<br>"; Gives bakit paulit ulit bakit ulit But no way could I get it to output "lang" in the list.
-
can't retrieve values from Multiple selected list
Barand replied to Cyjm1120's topic in PHP Coding Help
You are not echoing the option value Change <?php $existing_mID[$j];?>" > to <?php echo $existing_mID[$j];?>" > -
array_slice doesn't have an "end_point', it has a "start point" and "number of elements"
-
Use natsort(). That will sort as image1, image2, image10 .. etc
-
If I format that mess of code from your first post (as you should have done) things become clearer <?php connect_db(); //================================================================================ if(isset($_POST['submit'])=="login"){ $where="( email='".mysql_real_escape_string($_POST["email"])."') and ( password='". mysql_real_escape_string($_POST["password"])."')"; $seldata=$nds->webdreamselect('tbl_users',$where,'','','',''); echo mysql_error(); if(mysql_num_rows($seldata)!=0){ $customer_details=mysql_fetch_array($seldata); echo mysql_error(); $_SESSION["member_id"]=$customer_details["id"]; header("location: home.php"); }else{ $message="Invalid Username / Password Please try again."; } } //================ ?> isset() returns true or false and so will not equal "login". That line should be if(isset($_POST['submit']) && $_POST['submit']=="login") { The code never executes and $message never gets a value, hence your "not defined" message
-
1. Don't shout. 2. Use code tags when posting code or use the <> button 3. Try using array_intersect()
-
example $sql = "SELECT COUNT(*) as tot FROM mytable WHERE data = 'x'"; $res = mysql_query($sql); $row = mysql_fetch_assoc($res); echo $row['tot']; // --> number of records NB: Stop using mysql_xxx functions and change to mysqli_xxx or PDO
-
Use a for() loop to create the table body. It's much easier. <?php $today = date("Y-m-d"); for ($i=1; $i<=24; $i++) { echo <<<ROW <tr> <td>$i</td> <td> <input type="text" name="installment[$i]" id="installment" class="span4" value="0" /> </td> <td> <input type="text" name="due_date[$i]" class="tcal span4" value="$today" /> </td> </tr>\n ROW; } ?> Note the names of the input fields name="installment[$i]" name="due_date[$i]" This will post the data in an array which can, again, be easily processed in a loop. foreach ($_POST['installment'] as $k => $amount) { $date = $_POST['due_date'][$k]; // insert $amount and $date into table }
-
How to save three variables from different queries
Barand replied to Cyjm1120's topic in PHP Coding Help
The whole point of using SESSION variables is so that the values persist from page to page. -
How to save three variables from different queries
Barand replied to Cyjm1120's topic in PHP Coding Help
-
There are several weather api's out there where you can get a weather feed for free, for example http://www.worldweatheronline.com/free-weather.aspx All you need to do is parse the returned data (usually xml or json) and display the appropriate image according to the weather description.
-
I thought that was your intention.
-
Sounds more like a Photoshop problem than a PHP one.
-
You could parse the XML and create the SQL CREATE TABLE queries. Something like this will do it <?php $xml = simplexml_load_file('db.xml'); // use your xml file name here $sql = ""; foreach ($xml->TABLES->TABLE as $t) { $sql .= "CREATE TABLE `{$t['NAME']}` (\n"; foreach ($t->FIELDS->FIELD as $f) { $sql .= "`{$f['NAME']}` "; switch ($f['TYPE']) { case 'int': $sql .= "INT({$f['LENGTH']}) "; break; case 'char': $sql .= "VARCHAR({$f['LENGTH']}) "; break; case 'number': $sql .= "FLOAT(8,4) " ; break; case 'text': $sql .= "TEXT " ; break; } if ($f['UNSIGNED']=='true') { $sql .= "UNSIGNED "; } if ($f['NOTNULL']=='true') { $sql .= "NOT NULL "; } if ($f['SEQUENCE']=='true') { $sql .= "AUTO_INCREMENT "; } else { if ($f['NOTNULL']=='true') { $sql .= "DEFAULT 0 "; } } $sql .= ",\n"; } $sql .= "PRIMARY KEY ({$t->KEYS->KEY['FIELDS']}),\n"; $idx = $t->INDEXES->INDEX; $sql .= "INDEX "; if ($idx['UNIQUE']=='true') { $sql .= "UNIQUE "; } $sql .= "{$idx['NAME']} ({$idx['FIELDS']})\n"; $sql .= ");\n\n"; } ?> <html> <head> <title>XML to SQL sample</title> </head> <body> <pre> <?=$sql?> </pre> </body> </html>
-
Why the "GROUP BY id"? Don't you mean "ORDER BY id"? Do you want to try recalculating those start record numbers? first 10: 0 - 9 next 10: 10 - 19 next 10: 20 - 29
-
It looks like you are trying to nest the "selects". I don't see "</select>" after the first set of options and before the next <select>
-
Having got the array (say, $all_images) of ipg names using glob() you can use array_slice() to get the 30 images. images for page $p would be $images = array_slice($all_images, ($p-1)*30, 30);
-
Don't ignore the date change, check for it $time1 = new DateTime('22:00'); $time2 = new DateTime('03:00'); $current_time = new DateTime('04:00'); if ($time2 < $time1) { $time1->sub(new DateInterval('P1D')); } if ($current_time > $time1 && $current_time < $time2) { echo "Between"; } else { echo "Outside"; }
-
My apologies for my shortcomings in the psychic telepathy department