Jump to content

flashx

Members
  • Posts

    10
  • Joined

  • Last visited

    Never

Posts posted by flashx

  1. Hi guys,

     

    I have a bit of a problem,

     

    Im using php and mysql and have succeded in storing variables inside of a URL:

    
    echo "<a href='report.php?id=$varmemberid&colour=$varcolour'>test</a> ";
    

     

    i retrieve varmemberid and colour from the mysql database:

    
    $tbl_name = "members";
    
    			mysql_select_db($db_name) or die (mysql_error());
    
    			$query="SELECT * FROM $db_name ORDER BY  `members`.`the_members` ASC";
    			$result=mysql_query($query);
    
    
    			$num=mysql_numrows($result);
    
    			$i=0;
    			while ($i < $num) {
    			$varmemberid=mysql_result($result,$i,"member_id");	
    			$varcolour=mysql_result($result,$i,"colour");
    

     

    that works all fine and dandy for numbers eg: "123" however if i go to insert a member id of "123t" i get this error:

    Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 12 in /home/flashx/public_html/login/report-header.php on line 47
    

     

    im guessing it has something to do with the 'int' in this line:

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

     

    how do i fix this?

     

    Cheers

     

  2. Thanks Buddski,

     

    Im actually here because I have spent the last few days trying to nut it out but cant actually get it working! I need some help with a good clean example, would you (or anyone else) recommend any good tutorials on dynamically creating textboxes and saving back into a mysql database?

     

    Cheers

  3. Hi guys,

     

    does anyone know how to dynamically create a textfeild and fill it with a specific cell data from mysql?

     

    also is there anyway to have it that it is updatable when i press a button to save it?

     

     

    cheers

  4. Hi ladies and gents,

     

    Im new to PHP & mysql, so please go easy on me :)

     

    I have connected my mysql database up to my php webpage but im having a bit of trouble gettin my head round dynamically displaying and updating a row of fields using input textboxes.

     

    currently i have this:

    $i=0;
    while ($i < $num) {
    
    $myname=mysql_result($result,$i,"firstname");
    echo "<input type='text' name='name' value='$myname'><br/>";
    
    $i++;
    }
    
    
    

    (the above displays all names in the firstname field)

     

    my fields are as follows:

     

    firstname, lastname, age, gender etc

     

    so i guess my question is, how do i create a script that runs through each row and dynamically displays each field in a textbox which in turn is updatable by clicking a save button?

     

     

    Any help would be much appreciated.

     

     

    Cheers

     

     

  5. Hi guys,

     

    im needing to grab information out of a mysql database field called "clientname" thats inside a table called "clients"

     

    how do i retrieve the clients name in html and display it?

     

    heres what i have so far, am just needing the code to retrieve...

     

    
    $host = localhost;		
    $dbuser = user;		
    $dbpass = pass;		
    $dbname = mydb;	
    
    $connection = mysql_connect($host, $dbuser, $dbpass);	
    $db = mysql_select_db($dbname, $connection);
    
    // code to retrieve a particular clients details
    
    

     

     

     

     

    Cheers,

  6. hi there,

     

    im new to all this stuff, so im guessing this is quite easy to fix.

     

    i trying to get php to create a new user in a form in myphpadmin, however it seems to only accept numbers, does anyone know why?

     

    here is my code for php:

    <?php //begin
    
    $host = localhost;
    $dbuser = user;
    $dbpass = pw;
    $dbname = dbname;
    
    $connection = mysql_connect($host, $dbuser, $dbpass);
    $db = mysql_select_db($dbname, $connection);
    
    //grab data from form
    $name = $_POST[username];
    $pass = $_POST[password];
    $pass_conf = $_POST[pass_conf];
    $email = $_POST[email];
    
    
    if($name == false || $pass == false || $pass_conf == false || $email == false){
    echo "Please fill in all required fields.";
    };
    
    if($pass != $pass_conf){
    echo "Passwords do not match";
    }else{
    $connection = mysql_connect($host, $dbuser, $dbpass);
    $db = mysql_select_db($dbname, $connection);
    $sql = "INSERT INTO user (username,password,email) VALUES ($name, $pass, $email)";
    $result = mysql_query($sql);
    echo "Thank you for your registration to YOURSITENAME.com";
    };
    
    ?>
    
    

     

     

    and here is my form:

    <!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>Untitled Document</title>
    </head>
    
    <body>
    
    
    <form name=reg action=do_reg.php method=post>
        Username: <input name=username type=text /><br />
        Password: <input type=password name=password /><br />
        Confirm: <input type=password name=pass_conf /><br />
        Email: <input type="text" name=email /><br />
    
      <input type="submit" value='Register' />
    </form>
    
    
    </body>
    </html>
    
    
    

     

     

    any help would be great!

  7. Hi guys,

     

    this is my first post, and im needing some help with email and variables in php.

     

    when i save this out it works:

    
    <?php
    
    $test = "hi there";
    mail('myemail@mythingy.com.au','test subject', 'This is a test');
    ?>
    
    
    

     

    but as soon as i add variable into the mix it doesnt work...

     

     

    
    <?php
    
    $email = "myemail@mythingy.com.au";
    
    mail($email,'test subject', 'This is a test');
    ?>
    
    
    

     

     

    any clues?

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