sasa
Staff Alumni-
Posts
2,804 -
Joined
-
Last visited
-
Days Won
1
Everything posted by sasa
-
add ' around $ordPhone in your query $query = "SELECT O.ordPhone, O.ordSessionID, C.cartSessionID, C.cartID, Co.coCartID FROM orders O LEFT JOIN cart C ON C.cartSessionID = O.ordSessionID LEFT JOIN cartoptions Co ON Co.coCartID = C.cartID WHERE O.ordPhone = '$ordPhone' GROUP BY O.ordPhone";
-
<?php $addRecord->Documents[0]->name = 'a'; $doc = 'Documents'; $i = 0; $name = 'name'; echo $addRecord->{$doc}[$i]->{$name}; ?> add some { and }
-
trying to join Members table and members pics table?!
sasa replied to jarv's topic in PHP Coding Help
change INNER JOIN to LEFT JOIN -
Trying to read a text file and save it as X files all Y lines long...
sasa replied to physaux's topic in PHP Coding Help
on my netbook this code <?php $t = microtime(1); $test = file('tolstoy.txt');//65k lines $test = array_merge($test, $test); $test = array_merge($test, $test); $test = array_chunk($test, 1000); $name = 'part'; $i = 0; foreach ($test as $part){ $i++; $f = fopen('part'.$i.'.txt', 'w'); $part = implode("\n",$part); fwrite($f, $part); fclose($f); } echo microtime(1)-$t," $i"; ?> output 1.6787929534912 262 -
cant find anything wrong with it but it still throws errors
sasa replied to Danny620's topic in PHP Coding Help
you didn't connect to database you error is in 'mysqli.php' -
length of string $suchstring ($suchstring = substr($file, 0, 10) is 10 and in line $sucharray[] = $suchstring[10]; you tray to get 11th carather
-
change to $query = "INSERT INTO addsellers VALUES ('','$first','$last','$business','$address','$county','$telephone','$mobile','$email','$web','$about','image1')";mysql_query($query) or trigger_error('Error in: '.$query. ' - '.mysql_error(), E_USER_ERROR); and see query
-
error is in line $image1=$POST[image1'];
-
getting this error : Invalid argument supplied for foreach().....
sasa replied to n000bie's topic in PHP Coding Help
try to change function to function string2array($string,&$myarray){ $lines = explode("\n",$string); foreach ($lines as $value){ $items = explode('^',$value); if (sizeof($items) == 2){ $myarray[$items[0]] = $items[1]; } else if (sizeof($items) == 3){ $myarray[$items[0]][$items[1]] = $items[2]; } else echo 'error in string2array function'; } } -
getting this error : Invalid argument supplied for foreach().....
sasa replied to n000bie's topic in PHP Coding Help
try to change function to function string2array($string,&$myarray){ $lines = explode("\n",$string); foreach ($lines as $value){ $items = explode("&#183;",$value); if (sizeof($items) == 2){ $myarray[$items[0]] = $items[1]; } else if (sizeof($items) == 3){ $myarray[$items[0]][$items[1]] = $items[2]; } else echo 'error in string2array function'; } } -
change if (empty($startrow)) { $startrow=0; } to $startrow = $_GET['startrow'] ? $_GET['startrow'] : 0;
-
look http://dev.mysql.com/doc/refman/5.0/en/mathematical-functions.html#function_rand On 1st page generate random seed and use it on another
-
try to change line if ($offset > 0) continue; to if ($offset-- > 0) continue;
-
close loop before declaration of functions
-
Left Join count resulting rows per attribute where blah = blah
sasa replied to SchweppesAle's topic in PHP Coding Help
try $query = "SELECT #__jt_banners.id , #__jt_banners.title , #__jt_banners.img_location , #__jt_banners.impressions , #__jt_banners.start_date , #__jt_banners.expiration_date , #__jt_banners.published , #__jt_banner_clicks.id , #__jt_banner_clicks.banner_id , COUNT(#__jt_banner_clicks.banner_id) as bann_cnt FROM #__jt_banners LEFT JOIN #__jt_banner_clicks ON (#__jt_banners.id = #__jt_banner_clicks.banner_id) GROUP BY #__jt_banners.id"; -
change function to function select($arr){ foreach ($arr as $key => $value) { if (is_null($value)) { unset($arr[$key]); } } $last_item = end($arr); $last_item = each($arr); reset($arr); return implode(', ',$arr); }[/codeg
-
setup $G=$start; before loop
-
change form to <label>Item: </label> <input type="text" name="item[]" /> <label>Qty: </label> <input type="text" name="InvoiceQty[]" style="width: 20px; text-align: center;" /> <label>Price: </label> <input type="text" name="InvoicePrice[]" style="width: 50px;" value="£" /> and foreach($item as $k => $item1) { $query = "INSERT INTO invoice_items (item, quantity, price) VALUES ('$item1', '$qty[$k]', '$price[$k]')"; $query = mysql_query($query); }
-
Problem Selecting Multiple Groups of a Certain Column
sasa replied to factoring2117's topic in PHP Coding Help
or <?php $sql = mysql_query("SELECT * FROM name_table"); $i = 0; while($row = mysql_fetch_array($sql)) { if ($i++ == 0) echo "<div>"; echo $row['name']; if ($i < 50){ echo ', '; } else { echo '</div>'; $i = 0; } } if ($i > 0) echo '</div>'; ?> -
in line $query = " SELECT ".select($arr)." FROM ".$fromdefault1.$namefrom.$fromdefault2.$fromdefault3.$numresform1.$numresform2.$audiofrom.$videofrom.$imagefrom." WHERE ".$wheredefault.$datesearch.$timesearch.$latandlongsearch . " "; you call function select it echo some strings and return null after that concat this (null) in string in next line script echo this new string
-
try to change short php tags change '<?' to '<?php'
-
Inserting Another Field - relational trouble
sasa replied to EternalSorrow's topic in PHP Coding Help
<?php $sql = "SELECT *, UPPER(SUBSTRING(title,1,1)) AS letter FROM feudal WHERE `type` = 'Fanart' GROUP BY title, author ORDER BY title"; $query = mysql_query( $sql ) or die(mysql_error()); $ranges = range('A', 'Z'); array_unshift($ranges, '#'); while ($records = @mysql_fetch_array ($query)) { if (!in_array($records['letter'], $ranges)) $records['letter']='#'; $alpha[$records['letter']][] = $records; // ${$records['letter']}[$records['author']] = $records['title']; // $url= $records['url']; } //echo '<ul class="alphabet"> //<li><a href="#other">#</a></li>'; // Create Alpha link Listing foreach($ranges as $i) { echo (array_key_exists ($i, $alpha)) ? '<li><a href="#'.$i.'">'.$i.'</a></li>' : '<li>'.$i.'</li>'; } echo '</ul><ol class="listfanart">'; // Create Data Listing foreach($alpha as $i => $r) { // if (array_key_exists ("$i", $alpha)) { echo '<a name="'.$i.'"></a><h3>'.$i.'<div style="font-size: 10px; float: right;"><a href="#">top</a></h3>'; foreach ($r as $records) { $url = $records['url']; $key = $records['author']; $value = $records['title']; echo '<li><a href="'.$url.'" target="_blank">'.$value.'</a> by '.$key.'</li> '; } // } } ?> -
Sizeing issue on a returned php variable field in a table
sasa replied to Gilly79's topic in PHP Coding Help
try echo "<td class=BorderMeRed>". "<img src=\"http://dj-info.netai.net/images/" . $row["Pic"] ."\" width=\"50\" height=\"50\" /> <br>";