Not signed in (Sign In)

SkillShare - A place to discuss Web Standards and Web Design topics

Categories

Vanilla 1.1.9 is a product of Lussumo. More Information: Documentation, Community Support.

    • CommentAuthorjustjack
    • CommentTimeOct 24th 2006
     permalink
    I have the form set up and I've connected with the database So, how do I get the two to work together with PHP and SQL? I have my form as .php. What script do I need for it to go the the database?
    • CommentAuthoreplawless
    • CommentTimeOct 24th 2006
     permalink
    now you use SQL queries to modify/query your database. the php manuals will help you quite a bit, or you can take a look at a tutorials site; I usually use phpfreaks.com but there are many, many sites out there. or if you really don't give a shit about that sort of thing, this is from http://ca.php.net/manual/en/ref.mysql.php :

    <?php
    // Connecting, selecting database
    $link = mysql_connect('mysql_host', 'mysql_user', 'mysql_password')
    or die('Could not connect: ' . mysql_error());
    echo 'Connected successfully';
    mysql_select_db('my_database') or die('Could not select database');

    // Performing SQL query
    $query = 'SELECT * FROM my_table';
    $result = mysql_query($query) or die('Query failed: ' . mysql_error());

    // Printing results in HTML
    echo "<table>\n";
    while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
    echo "\t<tr>\n";
    foreach ($line as $col_value) {
    echo "\t\t<td>$col_value</td>\n";
    }
    echo "\t</tr>\n";
    }
    echo "</table>\n";

    // Free resultset
    mysql_free_result($result);

    // Closing connection
    mysql_close($link);
    ?>
    • CommentAuthorjustjack
    • CommentTimeOct 24th 2006 edited
     permalink
    I was able to figure it out and have solved other issues along the way. Now, I just need to know how to upload and attachment that is currently in my form directly to mysql. Suggestions?
Add your comments
    Username Password
  • Format comments as (Help)