Jump to content

soryn4u

Members
  • Posts

    18
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

soryn4u's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. thanks a lot .... Pikachu2000 ... it works... great !
  2. the code works in that form...but i want a simple way...a dynamic way for example i have this.. <?php $number = 25; for ($i = 0; $i < $number; $i++){ echo $content[$i] = $xml->data[$i]; } //then i create this code...to be inserted into db $content = $content[1].$content[2].$content[3].$content[4].$content[5].$content[6].$content[7].$content[8].$content[9].$content[10].$content[11].$content[12] .$content[13].$content[14].$content[15].$content[16] .$content[17].$content[18].$content[19].$content[20].$content[21].$content[22].$content[23].$content[24]; $sql = mysql_query ("insert into database (content) values ('$content')") or die(mysql_error()); //but i dont like it... i want.... thist part --------> $content = $content[1].$content[2].$content[3].$content[4] ---> to be dynamic.. ?>
  3. which part you dont understand? i now.. i always...have ideas... who create confusion :confused:
  4. i have this code... and i want to make it more dynamic.... <?php $content = $content[1].$content[2].$content[3].$content[4].$content[5].$content[6].$content[7].$content[8].$content[9].$content[10].$content[11].$content[12] .$content[13].$content[14].$content[15].$content[16] .$content[17].$content[18].$content[19].$content[20].$content[21].$content[22].$content[23].$content[24]; $sql = mysql_query ("insert into database (content) values ('$content')") or die(mysql_error()); ?> for example... instead content[1]. content[2]. content[3] ...etc... i want something like this....... $content = $content[from 1 to 24]; or $content = $content[from 1 to 777]; any solutions?
  5. <li id="top">Colors </li> <li id="left">Orange</li> <li id="left">Blue</li> <li id="left">Pink</li> <li id="left"> Red </li> <p>how to transform this code to appear into a table like this , using php function preg_match_all </p> <table> <tr> <td>Colors</td> </tr> <tr> <td>Orange</td> <td>Blue</td> <td>Pink</td> <td>Red</td> </tr> </table> where: <li id="top"> become <tr> <li id="left"> become <td>
  6. thanks for your solution...and for advices nrg_alpha
  7. thanks man for your time i add 2 extra code and now matches and 8655 and Flamengo : Cruzeiro amazing <?php $matches = array(); preg_match_all('/([a-z0-9]+(:|\.| : |[0-9])[a-z0-9]+)/i', $contents, $matches); print_r($matches); ?>
  8. Thaks it`s working i want you to ask...if i want to retrieve some complex data like strings and numbers in same time its possible to do this thing? for example <?php $contents =' <li id="cote">8655</li> <li id="echipe"> Flamengo : Cruzeiro </li> <li id="cote">23:55</li> <li id="cote"> 2.00 </li> <li id="cote"> 3.25 </li> <li id="cote"> 3.25 </li> <li id="cote"> 1.24 </li> <li id="cote"> 1.63 </li> <li id="cote"> 1.24 </li> '; ?> and result to be: 8655 Flamengo : Cruzeiro 23:55 2.00 3.25 3.25 1.24 1.63 1.24
  9. if i use youre code <?php $contents =' <li id="cote">23:55</li> <li id="cote">1.40</li> <li id="cote"> 4.00 </li> <li id="cote"> 1.04 </li> <li id="cote"> 2.49 </li> <li id="cote"> 1.15 </li> '; $matches = array(); preg_match('/\d{1,2}(:|.)\d{1,2}/', $contents, $matches); print_r($matches); //the result is ?> Array ( [0] => 23:55 [1] => : ) and i lose: 1.40 4.00 1.04 2.49 1.15
  10. i have a problem for example i want to use eregi to retrive data i want to retrive data from an website the code from the page looks like this <li id="cote">23:55</li> <li id="cote">1.40</li> <li id="cote"> 4.00 </li> <li id="cote"> 1.04 </li> <li id="cote"> 2.49 </li> <li id="cote"> 1.15 </li> if i use if (eregi('<li id="cote">(.*)</li>', $line, $out)) { $categ = each ($out); echo $categ[1]."\n"; } the result is <li id="cote">23:55</li> <li id="cote">1.40</li> i retrive only a part of the code becouse are whitespaces or new lines between <li id="cote">(.*)</li> how to use eregi... to retrive all the data ? becouse works only this part <li id="cote">23:55</li> <li id="cote">1.40</li> and i lose this part <li id="cote"> 4.00 </li> <li id="cote"> 1.04 </li> <li id="cote"> 2.49 </li> <li id="cote"> 1.15 </li>
  11. dosent work cookies with cronjob? i make a file cookie.php and i put this code <?php setcookie("user", "ADMIN"); if (isset($_COOKIE["user"])) echo "Welcome " . $_COOKIE["user"] . "!<br />"; else echo "Welcome guest!<br />"; ?> and i run cronjob */1 * * * * public_html/cookie.php and the result is : Welcome guest!<br > that means the cookie not set up!! How to make cookie works with cronjob ???
  12. i put this in .httacces ------------------ AddType application/x-httpd-php .php .htm .html Options +FollowSymLinks RewriteEngine On RewriteBase / RewriteRule ^view/?$ view.php?city [L] RewriteRule ^view/(.+)/?$ view.php?city=$1 [QSA] RewriteRule ^view/([^/]+)/id/([^/]+)/?$ view.php?city=$1&id=$2 [QSA,L] ------------------- my erorr is this Query Faild: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE id =' at line 1 and my php is this <?php $z = $_GET['city']; $query = 'SELECT * FROM '.$z.' WHERE id = '.$_GET['cat'].' '; ?> any solutions?
  13. i have on a page something like this <?php $z = $_GET['city']; $query = 'SELECT * FROM '.$z.' WHERE ... ......... ?> in my browser my link appear like this ---> view.php?city=torino&cat=4 i want to make a rewrite url i want something like this ------> view/torino/4 --------------------------------> view/oslo/15 --------------------------------> view/milan/1 torino - oslo - milan ..represent $_GET['city']; if i put in .httacces RewriteRule ^view/([^/]+)/id/([^/]+)/?$ view.php?city=$1&id=$2 [QSA,L] dosent work :| i make a mistake?
×
×
  • 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.