Jump to content

robert_gsfame

Members
  • Posts

    876
  • Joined

  • Last visited

Posts posted by robert_gsfame

  1. assume that i have two column firstname = 'jane' and lastname='Lambert'

    then i want to get the value using $_POST

     

    $firstname = $_POST['firstname'];

    $lastname = $_POST['lastname'];

    echo $firstname.' '.$lastname =====> result Jane Lambert

     

    what if firstname = 'Jane' and lastname='Lambert Sugar'

    echo $firstname.' '.$lastname =====> result Jane Lambert ????

     

    it will only take Jane and Lambert, how to make the third words included into lastname so that it will result Jane Lambert Sugar

     

     

    Help please :confused:

     

  2. friends, how can i prevent  " \ " this special character using ereg

    for example " . " then i will use ereg("\.",$data) so how bout " \ "

     

    and how prevent those special such as "." "*" "%"characters being typed in one preg

     

    thanks

     

  3. Is it correct if i put this way

     

    <?php session_start();?>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml">

    <head>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <title></title>

    <meta name="description">

    <meta name = "keywords">

    <style type = "text/css">

    </style>

    <script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>

    <?php require_once['config.php'];?>

    </head>

     

     

    i created this using dreamweaver, and when i put this way, highlighted <?> mark appeared on my properties

     

    is there something wrong with the code, can explain it to me about the meaning of that error?

    :confused:

  4. Is it correct if i put this way

     

    <?php session_start();?>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml">

    <head>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <title></title>

    <meta name="description">

    <meta name = "keywords">

    <style type = "text/css">

    </style>

    <script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>

    <?php require_once['config.php'];?>

    </head>

     

     

    i created this using dreamweaver, and when i put this way, highlighted <?> mark appeared on my properties

     

    is there something wrong with the code, can explain it to me about the meaning of that error?

     

     

     

  5. require_once['bla.php'] ----> it's a connection to mysql database

     

    bla.php

    $host="localhost";

    $username="xxxx";

    $password="xxxx";

    $db_name="xxxx";

     

    mysql_connect("$host", "$username", "$password")or die("cannot connect to server");

    mysql_select_db("$db_name")or die("cannot select DB");

     

     

  6. Does anyone have the solution for this. i actually want to create a login form but when username textbox left blank, alert popup started to appear stated "Username cannot left blank", else it comes to page2.php and POST the username.

     

    Page2: $username = $_POST['username'];

              echo  $username;

     

    Please help me for page1 :shrug:

     

    (*Don't relate this to sql database*)

     

     

     

  7. this is the code written

    <html>

    <link rel="shortcut icon" xxxxxxx >

    <title>blablabla</title>

    <body>

    </body>

    </html>

    this is the code but the problem is that window title didn't change as what was written which is blablabla

     

    I don't know why this happened

  8. Hello everyone, i created my own html page using dreamweaver, but the problem is that the title doesn't change although i've tried to change the <title>blabla</title> but the title didn't change as what written which is blablabla

     

    does anyone can give me this explanation and what to do?

     

    thanks in advance :o

  9. Hello all php masters! Does anyone know how to create a chatroom not shoutbox...

    I want to create chatroom but i don't want page to be refreshed in certain seconds as it's annoying users.

     

    Anyone has the idea ;D

     

    Thanks in advance

  10. I want to make a search engine for user and display records in several pages.  when i try it, at first page records displayed correctly but when i click on the second page "2" , ">" or ">>", all gone wrong. does anyone can help me? thx in advance!! here is my code:

    $variable = $_GET['city'] ;

    $variable2 =$_GET['title'] ;

    $variable3 =$_GET['field'] ;

    $variable4 =$_GET['country'] ;

     

    $trimmed = trim($variable);

    $trimmed2 = trim($variable2);

    $trimmed3 = trim($variable3);

    $trimmed4 = trim($variable4);

    $table = "members";

     

    $search = "city";

    $search2 = "title";

    $search3 = "field";

    $search4 = "country";

     

    $query = "SELECT COUNT(*)FROM $table WHERE $search2 LIKE '%$trimmed2%'AND $field_to_search3 LIKE '%$trimmed3%' AND $field_to_search LIKE '%$trimmed%' AND $field_to_search4 LIKE '%$trimmed4%' ORDER BY firstname";

     

    $result = mysql_query($query) or trigger_error("SQL", E_USER_ERROR); 

    $r = mysql_fetch_row($result); 

    $numrow = $r[0]; 

     

    $rowsperpage = 1; 

    $totalpages = ceil($numrow / $rowsperpage); 

       

    if (isset($_GET['currentpage']) && is_numeric($_GET['currentpage'])) { 

       

        $currentpage = (int) $_GET['currentpage']; 

     

    } else { 

        $currentpage = 1; 

      if ($currentpage > $totalpages) { 

         

        $currentpage = $totalpages; 

      if ($currentpage < 1) { 

         

        $currentpage = 1; 

    }

      $offset = ($currentpage - 1) * $rowsperpage; 

     

     

    $query = "SELECT * FROM $table WHERE $field_to_search2 LIKE '%$trimmed2%'AND $field_to_search3 LIKE '%$trimmed3%' AND $field_to_search LIKE '%$trimmed%' AND $field_to_search4 LIKE '%$trimmed4%'  ORDER BY firstname LIMIT $offset, $rowsperpage";

     

    $result = mysql_query($query) or trigger_error("SQL", E_USER_ERROR);

     

    $count = mysql_num_rows($result);

     

    $info = mysql_fetch_array($result);

     

    $numresults=mysql_query($query);

     

    $numrows=mysql_num_rows($numresults);

     

     

     

    if ($numrows == 0 )

     

     

    {

     

     

    echo "<center><font face=arial><h4>Results</h4></font></center>";

     

    echo "<center><font face=arial size=2><p>Sorry, your search </font>"."<font face=arial size=2> returned zero results</font></p></center>";

     

    }

     

     

    if (empty($s))

     

    {

     

    $s=0;

     

    }

     

    $result = mysql_query($query) or die("Couldn't execute query");

     

     

    if($numrows > 1 ){$return = "results";}

     

    else{ $return = "result"; }

     

    echo "<p><font face=arial size=2>Your search </font><font face=arial size=2>returned <strong>$totalpages</strong> $return</font></p>";

     

     

    $count = $s + 1  ;

     

    while ($row= mysql_fetch_array($result))

     

    {

     

    $city = $row["city"];

     

    $country = $r["country"];

     

    $count++ ;

     

    echo $city.$country

     

    }

      $range = 20; 

     

    echo"<center>";

    if ($currentpage > 1) { 

     

        echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=1'><img src='firstarrow.jpg' width=15 height=15 border=0></a> "; 

        $prevpage = $currentpage - 1; 

        echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$prevpage'><img src='previousarrow.jpg' width=15 height=15 border=0></a>"; 

    }   

     

      for ($x = ($currentpage - $range); $x < (($currentpage + $range) + 1); $x++) { 

         

        if (($x > 0) && ($x <= $totalpages)) { 

           

          if ($x == $currentpage) { 

             

              echo "<font face=arial size=2> [<b>$x</b>] </font>"; 

     

           

          } else { 

           

          echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$x' class=set6><font face=arial size=2>$x</font></a> "; 

          } 

        } 

     

    if ($currentpage < $totalpages) { 

         

        $nextpage = $currentpage + 1; 

           

        echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$nextpage'><img src='nextarrow.jpg' width=15 height=15 border=0></a>"; 

         

        echo "<a href='{$_SERVER['PHP_SELF']}?currentpage=$totalpages'><img src='lastarrow.jpg' width=15 height=15 border=0></a>"; 

    }

      echo"</center>";

     

    ?>

     

     

×
×
  • 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.