sasa
Staff Alumni-
Posts
2,804 -
Joined
-
Last visited
-
Days Won
1
Everything posted by sasa
-
$Handle = fopen('counter.php', 'a');
-
try echo "<table width='490' border='0' cellspacing='10' cellpadding='10'>"; //$num = mysql_num_rows($result); //$numrows = round($num/2); while ($row=mysql_fetch_array($result)) { extract($row); //$count=1; //while ($count<$numrows){ echo "<tr>"; //$count2=0; //while($count2<1){ echo "<td width='245' align='center' valign='top'><span class='content2 style2'>"; echo "<img src='$picaddy' alt='$firstname $lastname'> $lastname $firstname</span></td>"; //$count2=$count2+1; if ($row = mysql_fetch_array($result)){ extract($row); echo "<td width='245' align='center' valign='top'><span class='content2 style2'>"; echo "<img src='$picaddy' alt='$firstname $lastname'> $lastname $firstname</span></td>"; } else echo '<td> </td>'; //} //$count=$count+1; echo "</tr>"; //} } echo "</table>";
-
2 Select Box Filled Dynamically with Do While Loop
sasa replied to dprichard's topic in PHP Coding Help
or insert line mysql_data_seek($phine, 0); $row_phone = mysql_fetch_array($phone); before 2nd loop -
you read from file "users.db.php" and writw to file "counter.php"
-
in URL for 2nd page is 'page=1' if you want that this numbewr match change line $pages = array(); to $pages = array(''); and echo 'Total pages: ', count($pages), '<br />'; to echo 'Total pages: ', count($pages) - 1, '<br />'; and $page = $_GET['page'] + 0; to $page = $_GET['page'] ? $_GET['page'] : 1; and lines for($i = 0; $i < count($pages); $i++) { if ($i != $page) echo ' <a href="?page='.$i.'">'.($i +1).'</a> '; else echo ' '. ($i+1).' '; } to for($i = 1; $i < count($pages); $i++) { if ($i != $page) echo ' <a href="?page='.$i.'">'.($i).'</a> '; else echo ' '. $i.' '; }
-
try <?php $a = file_get_contents('20740-8.txt'); //split $a per pages $car_per_page = 10000; $pages = array(); while (strlen($a) > 0){ $b = str_split($a, $car_per_page); $x = $b[0]; unset($b[0]); $a = implode($b); $i = strlen($x); if (strlen($a) > 0) { while ($x[--$i] != ' '); $y = substr($x, 0, $i); $a = substr($x, $i). $a; } else { $y = $x; } $pages[] = $y; } echo 'Total pages: ', count($pages), '<br />'; $page = $_GET['page'] + 0; echo ($page + 1).' page;<br />'; echo '<pre>', $pages[$page], '</pre>'; for($i = 0; $i < count($pages); $i++) { if ($i != $page) echo ' <a href="?page='.$i.'">'.($i +1).'</a> '; else echo ' '. ($i+1).' '; } ?>
-
change 1++ to ++$sasa
-
remove do in line 29
-
try <?php $goallist = '1 Year Goal #1: Web Developer'; //$goallist = '10 Year Goal #2: IT Consultant'; echo $goalsheet = preg_replace("/^([0-9]+) Year Goal #([0-9]+: .*)$/", "<span class='hd2'>$1 Year Career Goal #$2</span><br>", $goallist); ?> or $goalsheet = "<span class='hd2'>" . $goallist . "</span><br>";
-
sorry my mistake change to if ($v == 'Delete' and array_key_exists($key, $_SESSION['box']))
-
How to restart id count from a auto_increment field when deleting a row
sasa replied to ferpadro's topic in PHP Coding Help
for prevent duplicate row you can add unique index to your table ALTER TABLE `services` ADD UNIQUE `my_index` ( technicianid, typeofserviceid, clientid, date, hour, hours, comments ) -
How to strip quotes (single and double) from a string in PHP
sasa replied to jwhite68's topic in PHP Coding Help
Ok try if(empty($ptitle)){ $description = addslashes($this->description); } else { $description = addslashes($ptitle) . ' - ' . addslashes($this->description); -
How to strip quotes (single and double) from a string in PHP
sasa replied to jwhite68's topic in PHP Coding Help
change $description = '$ptitle - $this->description"; to $description = "$ptitle - $this->description"; -
you don't have delimiter in 1st preg_match
-
check your typo in line $query = ... db reports that you ask for column 'user' bat in your query i see 'username'
-
is it what you want <?php $arrayA = array('sasa', '123', 'asd', 'ppp'); $arrayB = array('asd', 'sasa', 'ddd', '123', 'popo', 'ppp'); foreach ($arrayB as $nr) { echo 'Value: "', $nr; if (count($key = array_keys($arrayA, $nr)) > 0) echo '" exist in arrrayA with key ', $key[0], '<hr />'; else echo '" not exist in arrrayA.<hr />'; } ?>
-
try <?php session_start(); // generate testing value if (count($_SESSION['box']) == 0) $_SESSION['box'] =array(array('1-1','1-2'), array('2-1', '2-2', '2-3'), array('3-1', '3-2'), array('4-1')); if (count($_POST)) foreach ($_POST as $key => $v) if ($v == 'Delete' and array_key_exists($_SESSION['box'][$key])) unset($_SESSION['box'][$key]); $_SESSION['box'] = array_values($_SESSION['box']); // reorganize array keys // try to refresh page ! echo '<form method="POST">'; foreach($_SESSION['box'] as $CartItem=>$items) { foreach($items as $key => $item) echo '<div class="class'. ($key + 1) . '">'.$item.'</div>'; echo '<input type="submit" name="' . $CartItem . '" value="Delete" /><hr />'; } // for testing echo '<pre>'; print_r($_SESSION); echo '</pre>'; ?>
-
change echo "<table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="14" height="28" background="line_left_corner_top.png"> </td> <td height="28" colspan="4" background="line_top.png"> </td> <td height="28" background="line_right_corner_top.png"> </td> </tr> <tr> <td width="14" rowspan="3" background="line_left.png"> </td> <td width="290" height="21"><span class="Large_Blue">$Title</span></td> <td width="114" height="21"><img src="stars_five.png" width="114" height="21" /></td> <td width="14"> </td> <td width="128" height="128" rowspan="3"><<img src="/searchthumbs/$Country$Type.png" width="128" height="128" /></td> <td width="14" rowspan="3" background="line_right.png"> </td> </tr> <tr> <td height="86" colspan="2"><span class="Small_Black">$Abs</span></td> <td width="14"> </td> </tr> <tr> <td width="290" height="19" align="left" valign="bottom"><span class="style5">>></span> <span class="style7"><a href=asearcher.php?text=$More&Submit=Submit>Read More</a> </span> <span class="style5">>></span></td> <td width="114" height="19" align="left" valign="bottom"><span class="Small_Grey">12/09/2007</span></td> <td width="14"> </td> </tr> <tr> <td width="14" height="19" background="line_left_corner.png"> </td> <td height="28" colspan="4" background="line_base.png"> </td> <td width="14" height="19" background="line_right_corner.png"> </td> </tr> </table>"; to echo "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"> <tr> <td width=\"14\" height=\"28\" background=\"line_left_corner_top.png\"> </td> <td height=\"28\" colspan=\"4\" background=\"line_top.png\"> </td> <td height=\"28\" background=\"line_right_corner_top.png\"> </td> </tr> <tr> <td width=\"14\" rowspan=\"3\" background=\"line_left.png\"> </td> <td width=\"290\" height=\"21\"><span class=\"Large_Blue\">$Title</span></td> <td width=\"114\" height=\"21\"><img src=\"stars_five.png\" width=\"114\" height=\"21\" /></td> <td width=\"14\"> </td> <td width=\"128\" height=\"128\" rowspan=\"3\"><<img src=\"/searchthumbs/$Country$Type.png\" width=\"128\" height=\"128\" /></td> <td width=\"14\" rowspan=\"3\" background=\"line_right.png\"> </td> </tr> <tr> <td height=\"86\" colspan=\"2\"><span class=\"Small_Black\">$Abs</span></td> <td width=\"14\"> </td> </tr> <tr> <td width=\"290\" height=\"19\" align=\"left\" valign=\"bottom\"><span class=\"style5\">>></span> <span class=\"style7\"><a href=asearcher.php?text=$More&Submit=Submit>Read More</a> </span> <span class=\"style5\">>></span></td> <td width=\"114\" height=\"19\" align=\"left\" valign=\"bottom\"><span class=\"Small_Grey\">12/09/2007</span></td> <td width=\"14\"> </td> </tr> <tr> <td width=\"14\" height=\"19\" background=\"line_left_corner.png\"> </td> <td height=\"28\" colspan=\"4\" background=\"line_base.png\"> </td> <td width=\"14\" height=\"19\" background=\"line_right_corner.png\"> </td> </tr> </table>";
-
this IIS (eswack.com) don't suport .php files
-
try <?php $fax = '02345678 901'; $success_message = 'OK'; switch ($fax) { case (strlen($fax) ==0): echo "<div class='error'><b>Please fix the following errors:</b>\n<ul>"; echo "<li>Please enter a fax number</li></ul></div>"; break; case (preg_match('/^0/',$fax)==0): echo "<div class='error'><b>Please fix the following errors:</b>\n<ul>"; echo "<li>Please start your fax number with a zero</li></ul></div>"; break; case (preg_match("/ /", $fax)==1): echo "<div class='error'><b>Please fix the following errors:</b>\n<ul>"; echo "<li>Please enter the number without spaces</li></ul></div>"; break; case (preg_match("/[^0-9]/",$fax)==1): echo "<div class='error'><b>Please fix the following errors:</b>\n<ul>"; echo "<li>Please enter numbers only</li></ul></div>"; break; case (preg_match("/ /", $fax)==1): echo "<div class='error'><b>Please fix the following errors:</b>\n<ul>"; echo "<li>Please enter the number without spaces</li></ul></div>"; break; case (strlen($fax) != 11): echo "<div class='error'><b>Please fix the following errors:</b>\n<ul>"; echo "<li>Please enter a valid fax number (11 numbers long)</li></ul></div>"; break; default: echo "<div class='success'><h3>$success_message</h3></div>"; break; } ?>
-
try <?php mysql_connect('localhost'); mysql_select_db('test'); $re = mysql_query('SELECT id, indir, name FROM dir'); while ($r = mysql_fetch_array($re)) $list[$r['indir']][] = array('id' => $r['id'], 'name' => $r['name']); echo getLevels($list); //Recursive function to get any subdirectories. function getLevels($levels, $start=0, $pre = '../'){ $out = ''; if (isset($levels[$start])){ foreach($levels[$start] AS $listed) $out .= $pre. $listed['name']. "<br />\n" . getLevels($levels, $listed['id'], $pre.'../'); } return $out; } ?>
-
change line $page_rows = 10; to $page_rows = 40; and part //This is where you display your query results while($info = mysql_fetch_array( $data_p )) { Print $info['firstname']. ' '.$info['lastname']; echo " "; } echo "<p>"; to //This is where you display your query results echo '<table>'; $i = 0; while($info = mysql_fetch_array( $data_p )) { if($i % 4 == 0) echo '<tr>'; Print '<td>'. $info['firstname']. ' '. $info['lastname']. '</td>'; echo " "; if(++$i % 4 == 0) echo '</tr>'; } if($i % 4 != 0) echo '</tr>'; echo '</table>'; //echo "<p>";
-
try <?php $query2 = "SELECT name FROM images"; $result2 = mysql_query($query2); //$quantity = mysql_num_rows($result2); //start table echo '<table>'; //inicijalize $count $count = 0; while($row2 = mysql_fetch_array($result2)){ //print_r($row2); $ProImg2 = $row2[0]; if($count % 8 == 0) echo "<tr>"; //for($i=0;$i<$quantity;$i++){ //if($row2 %{ //sort the photos into 8 columns $imgLoc2="mall/smallthumbnail.php?i=http://localhost/photo_album/mall/images/$ProImg2&w=50&h=50"; ?> <td><A onmouseover=replaceImage($i);><IMG style="CURSOR: hand" height=50 alt="pink" src="<?php echo $imgLoc2; ?>" width=50 border="0"></A></td> <? $count++; if($count % 8 == 0) echo "</tr>"; //} //end if($row2 %8 != 0) // else { // echo "</tr>"; // echo "<tr>"; // } // }//end for loop if($count % 8 != 0) echo "</tr>"; echo '</table>'; } ?>
-
try foreach($_SESSION['box'] as $CartItem[]=>$items) { echo "<p>"; foreach($items as $key => $item) { if($key) $class = 'order'.++$key; else $class = 'order'; echo "<div class='$class'>$item</div>"; } echo "</p>"; } }