Jump to content

sasa

Staff Alumni
  • Posts

    2,804
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by sasa

  1. change if (empty($check)) to if ($_FILES[''fileatt]['error'] > 0)
  2. if($found < 1 and $username != $useronline){
  3. change function to function idcheck($id) { $check = mysql_fetch_array(mysql_query("SELECT * FROM `alphaground` WHERE `id` = '$id'")); if ($check[ownerid] == 0){ Print "<img src= images/keyneautural.png>"; }else{ Print "<img src= images/keyalliance.png>"; }} and call function <td>"; $id = 1; idcheck($id); Print" </td> <td>"; $id = 2; idcheck($id); Print" </td> <td>"; $id = 3; idcheck($id); Print" </td> <td>"; $id = 4; idcheck($id); Print" </td> etc
  4. you must pass variable $id to function naw value of $id is '' (null) and you query looks SELECT * FROM `alphaground` WHERE `id` = '' it not return any row $check is empty array and $check['ovnerid'] has no value
  5. try <?php $language = $_POST['lang']; // this is the checkbox array $setlanguage = "UPDATE prof_language SET "; for ($i = 1; $i <= 5; $i++){ $out[] = "lang$i = '".(in_array($i, $language) ? 1 : 0)."'"; } echo $setlanguage .= implode(', ', $out). " WHERE unid = '$session_id'"; mysql_query($setlanguage); ?>
  6. $outside = preg_replace('/<table(>| [^>]*>)(.*?)<\/table(> |>)/is', '',$a);
  7. try <form name="mainitem" action="../aea/result/mainitem.php" method="POST"> Select Supplier<select name="mainitem"> <?php while ($row2 = mysql_fetch_array($getmainitem)) {?> <option value=" <?php echo $row2['id']; ?> "> <?php echo $row2['mainitem'];} ?> </option>></select><BR> <input type="submit"/> </form><BR><BR> <?php echo "<table border='1'> <tr> <th>Itemname</th> <th>TotalStock</th> <th>Totalmass</th> <th>Totalprice</th> </tr>"; mysql_data_seek($getmainitem,0); while($row3 = mysql_fetch_array($getmainitem)) { echo "<tr>"; echo "<td>" . $row3['itemname'] . "</td>"; echo "<td>" . $row3['totalstock'] . "</td>"; echo "<td>" . $row3['totalmass'] . "</td>"; echo "<td>" . $row3['totalprice'] . "</td>"; echo "</tr>"; } echo "</table>";
  8. try <?php $a = 'blah bla <table><tr><td>name</td><td>age</td></tr> <tr><td>rajni</td><td>40</td></tr></table> mbrwgb '; preg_match('/<table(>| [^>]*>)(.*?)<\/table( |>)/is',$a,$b); $table = $b[2]; preg_match_all('/<tr(>| [^>]*>)(.*?)<\/tr( |>)/is',$table,$b); $rows = $b[2]; foreach ($rows as $row){ preg_match_all('/<td(>| [^>]*>)(.*?)<\/td( |>)/is',$row,$b); $out[] = strip_tags(implode(',',$b[2])); } $out = implode("\n", $out); print_r($out); ?>
  9. try $sql1="SELECT * FROM mytable where active='yes'"; $result1=mysql_query($sql1); while($rows1=mysql_fetch_array($result1)){ $id[]=$rows1['id']; } $count=4; for($i=0;$i<$count;$i++){ $sql2="UPDATE mytable SET active='no' WHERE id='$id[$i]'"; $result2=mysql_query($sql2); }
  10. try <?php $a = Array( Array( 'Color' => Array( Array('id' => 1, 'value' => 'Small'), Array('id' => 2, 'value' => 'Medium') ) ), Array( 'Size' => Array( Array('id' => 3, 'value' => 'SMall'), Array('id' => 4, 'value' => 'Medium'), Array('id' => 5, 'value' => 'Large') ) ), Array( 'Shape' => Array( Array('id' => 6, 'value' => 'Square'), Array('id' => 7, 'value' => 'Circle'), Array('id' => 8, 'value' => 'Triangle') ) ) ); $out = array(); foreach ($a[0] as $v) foreach ($v as $v1) $out[] = array($v1); for ($i = 1; $i < count($a); $i++){ $tmp = $out; $out = array(); foreach ($tmp as $t){ foreach ($a[$i] as $z){ foreach ($z as $z1){ $t1 = $t; $t1[] = $z1; $out[] = $t1; } } } } print_r($out); ?>
  11. you have error in your serialized string start of string 'a:306' means array with 308 elements, it's OK 'i:0;s:54:"Leguminosae subfamily FaboideaeAbrus_precatorius_herb";' -> on index 0 is string 54 char long but your string has 53 char, this is error etc. are you do some operation with serialized string before put it in database is it any caracter between Faboideae and Abrus in your 1st string?
  12. try <?php include ("functions.php"); connectto_guana_plants (); $picstorage = array (); $query = "SELECT serialized FROM serialized_data WHERE title = 'picstorage'"; $result = mysql_query($query) OR die(mysql_error()); $data = mysql_result($result,0); echo $data; $picstorage = unserialize($data); print_r ($picstorage); ?>
  13. try <?php $user1 = $_SESSION['username']; $user_sql = mysql_query("SELECT * FROM `users` WHERE `username` = '$user1'"); $userinfo = mysql_fetch_array($user_sql); $username = $userinfo['username']; $sql1 = mysql_query("SELECT * FROM `logs` WHERE `username` = '$username'") or die("Cannot select History at this time"); $sql1_rows = mysql_num_rows($sql1); if($sql1_rows == "0") { echo 'You have never done anything.'; } else { $total = 0; echo '<table border="0" align="center" width="60%"> <tr> <th>Date</th> <th>File Name</th> <th>FileSize (KB)</th> <th>IP</th> </tr>'; while($history = mysql_fetch_array($sql1)) { $total += $history['filesize']; echo '<tr> <td align="center">'.$history['fdate'].'</th> <td align="center">'.$history['filename'].'</th> <td align="center">'.$history['filesize'].'</th> <td align="center">'.$history['ip'].'</th> </tr>'; } echo '</table>'; } ?> </p> <p align="center">Total:</p> <p align="center"> <?php //$query = mysql_query("SELECT * FROM `logs` WHERE `username` = '$user1'"); //$rows = mysql_num_rows($query); echo $total; ?>
  14. try <?php $mytext = array( 'ololol', 'hilol', 'WTFBBQ', 'OMFGPWNISw##@234' ); function bold_text( &$text ) { $text = '<b>'.$text.'</b>'; } array_walk($mytext, 'bold_text'); print_r($mytext); ?>
  15. try $find=array( "/\[b\](.*)\[\/b\]/", "/\[i\](.*)\[\/i\]/", "/\[u\](.*)\[\/u\]/", "/\[img\](.*)\[\/img\]/", "/\[link\](.*)\[\/link\]/", "/\[big\](.*)\[\/big\]/", "/\[small\](.*)\[\/small\]/", "/\[red\](.*)\[\/red\]/", "/\[blue\](.*)\[\/blue\]/", "/\[green\](.*)\[\/green\]/", //"/\[quote\](.*)\[\/quote\]/" "/\[quote\]/", "/\[\/quote\]/" ); $rplc=array( "<b>$1</b>", "<i>$1</i>", "<u>$1</u>", "<img src='$1'/>", "<a href='$1'>$1</a>", "<h1>$1</h1>", "<h4>$1</h4>", "<font color='red'>$1</font>", "<font color='blue'>$1</font>", "<font color='green'>$1</font>", //"<div class='forumquote'>$1</div>" "<div class='forumquote'>", "</div>" );
  16. sasa

    Array

    look array_pop() function
  17. try <?php $fileName = 'test.dat'; // write file $a = fopen($fileName, 'w'); fwrite($a, 'website_title = PHP freaks'."\n"); fwrite($a, 'website_meta_key = PHP, solution, freaks'."\n"); fwrite($a, '[sasa]'."\n"); fwrite($a, 'blah = something'."\n"); fclose($a); //read file $a = parse_ini_file($fileName,1); print_r($a); //or echo "<hr />\n"; $a = parse_ini_file($fileName,0); print_r($a); ?>
  18. try <?php $fileName = 'test.dat'; $numLine = 3; $a = preg_replace("/^(.*?\n){0,$numLine}/",'', file_get_contents($fileName)); $b = fopen('test.dat', 'w'); fwrite($b, $a); fclose($b); ?>
  19. 1st I try to kreate array witk key = image name and value = image dir, sort this array with key (ksort) and utput key and value of sorted array, but if exist image with same name in both dirs the 2nd one replace 1st. I change my array that have key = image name and value = array of dirs. in 1st foeach i exstract key in variable $curimg an array of dirs in varijable $d in 2nd foreach i extract value(s) of $d in variable $dirname tray to print_r($out) if don't understund
  20. try <?php $string = 'http://www.imeem.com/shibuya7/video/Z1PR33um/ep_1_6_8_gokusen_ep_1_6_8_movies_video/'; $string = preg_match('|(?<=/video/)[^/ ]+|i', $string, $match); print_r($match[0]); ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.