Jump to content

Redlightpacket

Members
  • Posts

    68
  • Joined

  • Last visited

    Never

Posts posted by Redlightpacket

  1. I'm having a problem making the plus sign really bold. I need some help.

     

     

    p {
    width:17px;
    height:19px;
    padding:5px;
        text-align: center;
        
    border:1px solid #000;
        
        font-size: 17px;
        
        
    background-color:#darkslateblue }
    
    
    
    //the plus that is going to become bold.
    
    <p>+</p>
    
    

  2. I have been stuck on this problem for a while and I really need some help. What my code does is it displays data on the screen and the user can click a link that has a id=1 or whatever id, which it's purpose is to use to save data to the from row 1 or whatever id number it is in the table and copy it to the users table. I'm kind of confused about using the $_GET and trying to copy the data to the database with id and stuff? What do I do????

     

     

    <?PHP
    
    
    
    include 'connectdb.php';
    
    session_start();
    
    
    $id = "";
    
    ///////////////////////////////////////////////////////////////////////////////
    //Displays bible verses on the verse page.
    $query = "SELECT * FROM publictb";
    
    $result = mysql_query($query)
    or die("Query failed: " . mysql_error());
    
    while ($row = mysql_fetch_assoc($result))
    {
    
    echo'<table border="1">
    <tr>
    <td>';echo $row["idb"];echo'</td>
    <td>';echo $row["scriptrefb"];echo'</td>
    <td>';echo $row["scriptureb"]; echo'</td>
    <td><a href="http://localhost/new_insert.php?id='.$row["idb"]. '">SAVE</a></td>
    
    </tr>
    </table>
    ';
    
    }
    ///////////////////////////////////////////////////////////////////////////////
    
    //Count the row to the database and insert the data to the user database
    //Try to make a link from a button in php get function
    

     

  3.  

    I want to be able to click on an item and save it a table in a database or insert it into the table. How do I get the data to be saved from the mysql_fetch_assoc results to a table in a database.

    Below is some sample code to help you.

    $result = mysql_query($query)
    or die("Query failed: " . mysql_error());
    
    while ($row = mysql_fetch_assoc($result))
    {
    
    echo'<table border="1">
    <tr>
      <td>';echo $row["idb"];echo'</td>
      <td>';echo $row["scriptrefb"];echo'</td>
      <td>';echo $row["scriptureb"]; echo'</td>
    <td><a href="http://localhost/new_insert.php?id='  .  $row['username']. '">SAVE</a></td>
      </tr>
    </table>
    ';
    

  4. I want to be able to update data to one particular table each time a user submits their data to a table in a database. There will be different users logging in so I want the update statement to change to that particular user and update data to that particular table with the user logged in. Is this possible or do you go about this another way? I don't know how to do this. Could you give me an example of something that works.

     

     

    Thanks.

  5. i'm trying to get this statement to work but it don't work.

    How do you get "$username" part to work.

    What i'm trying to do is update the publictb from multiple user tables.

    $result = mysql_query("UPDATE $username, publictb SET scriptref='$scriptref' AND scripture ='$scripture' AND WHERE id='$id' AND scriptref='$scriptref' AND scripture ='$scripture'")

  6. I have did what it says to do on this page http://www.webmasterworld.com/forum88/4495.htm. I have added the other stuff to the configuration files but nothing really works. The web server works, but php don't work. But here is the link to my php.ini file and my httpd.conf file. Tell me what settings is wrong in them.

     

    download files here:

    http://www.mediafire.com/file/mzomzmjznmq/php.ini

    http://www.mediafire.com/file/joyhmyzzz3q/httpd.conf

     

     

     

    can check them out on my blog here: http://phpcodeexamples.blogspot.com

     

  7. I get Undefined index: variable or idea1 error when I come to the "simple page" by clicking on a common id on the "idea page". What's causing it is the $idea = addslashes($_POST['idea1']);-->I'm refering on the "simple page" here. But When I submit the data to the "simple page" again the Undefined index:variable error goes off the screen. Here is the "simple page":

     

    <html>
    <style type="text/css">
    <!--
    .style1 {
    font-family: Geneva, Arial, Helvetica, sans-serif;
    font-size: 36px;
    }
    .style2 {
    font-family: Geneva, Arial, Helvetica, sans-serif;
    font-size: 14px;
    font-weight: bold;
    }
    .style3 {
    font-family: Geneva, Arial, Helvetica, sans-serif;
    font-size: 14px;
    font-weight: bold;
    }
    .style4 {
    font-family: Geneva, Arial, Helvetica, sans-serif;
    font-size: 14px;
    font-weight: bold;
    }
    .style5 {
    font-family: Geneva, Arial, Helvetica, sans-serif;
    font-size: 14px;
    font-weight: bold;
    }
    -->
    </style>
    
    <?PHP
    $id = $_GET['id'];
    
    ?>
    
    <form method="post" action="http://localhost/simple.php?<?php echo'id='.$id;?>">
    
    
    
    
    <pre class="style1">Message</pre>
    
    <pre>
    
    <script language="Javascript">
    <!--
    
    function doClear(theText)
    {
    if (theText.value == theText.defaultValue)
    {
    theText.value = ""
    }
    }
    //-->
    </script>
    
    
    
    <span class="style5">Idea :</span> <textarea name="idea1" cols="55" onFocus="doClear(this)">Talk about whatever.
    
    </textarea>
    
    
    
    
    <input name="Submit1" type="submit" value="submit" style="width: 117px">
    </pre>
    
    <pre><--BACK <a href="http://localhost/idea.php">Home</a></pre>;
    
    </html>
    
    <?php
    
    
    ///////////////////////////////////////////////////////
    //--------------INPUT---------------------------------
    ///////////////////////////////////////////////////////
    
    
    
    
    //-------------------------------------------
    // Connects to database and selects database
    //-------------------------------------------
    
    
    define('DB_HOST', 'localhost');
    define('DB_USER', 'chris');
    define('DB_PASS', '');
    define('DB_NAME', 'ideadb');
    define('DEBUG', true);
    $con = mysql_connect(DB_HOST, DB_USER, DB_PASS);
    
    if(!$con)
    {
    // error connecting
    if(DEBUG === true)
    {
    die('Database connection error: ' . mysql_error());
    }
    else
    {
    die('Failed to connect to the database.');
    }
    }
    
    if(!mysql_select_db(DB_NAME, $con))
    {
    if(DEBUG === true)
    {
    die('Failed to select database, error: ' . mysql_error());
    }
    else
    {
    die('Failed to connect to database.');
    }
    }
    
    ///////////////////////////////////////////////////////////////////////////
    
    
    
    
    $idea = addslashes($_POST['idea1']);
    
    
    
    
    
    
    
    
    
    
    
    
    /////////////////////////////////////////////////////////////////////////
    // Creates a table if no table exists
    //////////////////////////////////////////////////////////////////////////
    $array = array('id', $id);
    $comma_separated = join("", $array);
    
    
    $sql="SELECT * FROM $comma_separated";
    
    $result=@mysql_query($sql);
    
    if (!$result)
    
    {
    
    echo "No table exists";
    
    
    
    //Combine $id to a word idtb
    $array = array('id', $id);
    $comma_separated = join("", $array);
    
    echo $comma_separated;
    
    
    
    
    $query = "CREATE TABLE IF NOT EXISTS $comma_separated(id SMALLINT NOT NULL AUTO_INCREMENT PRIMARY KEY, idea VARCHAR(450))";
    
    $result_create = mysql_query($query)
    or die("Query failed: ".mysql_error());
    }
    
    
    
    
    
    
    
    
    
    
    $query = "INSERT INTO $comma_separated(id, idea) VALUES (NULL, '$idea')";
    
    $result = mysql_query($query)
    or die("Query failed: ".mysql_error());
    
    /////////////////////////////////////////////////////////////////////////
    
    
    
    
    
    ///////////////////////////////////////////////////////
    //--------------OUTPUT---------------------------------
    ///////////////////////////////////////////////////////
    
    //Display Ideas on Webpage.
    //Need database code to do this with.
    
    
    
    
    
    $query = "SELECT * FROM $comma_separated";
    
    $result = mysql_query($query)
    or die("Query failed: " . mysql_error());
    
    
    
    
    
    
    while ($row = mysql_fetch_assoc($result))
    {
    
    
    echo'<table border="1">
    <tr>
    <td>';echo $row["id"];echo'</td>
    <td>';echo $row["idea"]; echo'</td>
    
    
    
    </tr>
    </table>
    ';
    
    
    }
    ///////////////////////////////////////////////////////
    
    
    ?>
    
    
    
    
    
    
    
    
    
    
    
    
    Here is the "idea page"
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    <html>
    <style type="text/css">
    <!--
    .style1 {
    font-family: Geneva, Arial, Helvetica, sans-serif;
    font-size: 36px;
    }
    .style2 {
    font-family: Geneva, Arial, Helvetica, sans-serif;
    font-size: 14px;
    font-weight: bold;
    }
    .style3 {
    font-family: Geneva, Arial, Helvetica, sans-serif;
    font-size: 14px;
    font-weight: bold;
    }
    .style4 {
    font-family: Geneva, Arial, Helvetica, sans-serif;
    font-size: 14px;
    font-weight: bold;
    }
    .style5 {
    font-family: Geneva, Arial, Helvetica, sans-serif;
    font-size: 14px;
    font-weight: bold;
    }
    -->
    </style>
    <form method="post" action="http://localhost/simple.php">;
    <pre class="style1">Message</pre>
    
    <pre>
    
    <script language="Javascript">
    <!--
    
    function doClear(theText)
    {
    if (theText.value == theText.defaultValue)
    {
    theText.value = ""
    }
    }
    //-->
    </script>
    
    
    
    <span class="style5">Idea :</span><textarea name="idea" cols="55" onFocus="doClear(this)">Talk about whatever.
    
    </textarea>
    
    
    
    
    <input name="Submit1" type="submit" value="submit" style="width: 117px">
    </pre>
    
    <pre><--BACK <a href="index.php">Home</a></pre>
    
    </html>
    
    
    <?php
    
    
    ///////////////////////////////////////////////////////
    //--------------INPUT---------------------------------
    ///////////////////////////////////////////////////////
    
    
    //-------------------------------------------
    // Connects to database and selects database
    //-------------------------------------------
    
    
    define('DB_HOST', 'localhost');
    define('DB_USER', 'chris');
    define('DB_PASS', '');
    define('DB_NAME', 'ideadb');
    define('DEBUG', true);
    $con = mysql_connect(DB_HOST, DB_USER, DB_PASS);
    
    if(!$con)
    {
    // error connecting
    if(DEBUG === true)
    {
    die('Database connection error: ' . mysql_error());
    }
    else
    {
    die('Failed to connect to the database.');
    }
    }
    
    if(!mysql_select_db(DB_NAME, $con))
    {
    if(DEBUG === true)
    {
    die('Failed to select database, error: ' . mysql_error());
    }
    else
    {
    die('Failed to connect to database.');
    }
    }
    ////////////////////////////////////////////////////////
    
    
    
    
    
    
    
    
    
    
    
    
    
    ///////////////////////////////////////////////////////
    //--------------INPUT---------------------------------
    ///////////////////////////////////////////////////////
    $idea = addslashes($_POST['idea']);
    
    //Just to give each table a name by user
    
    $query = "INSERT INTO stan(id, idea) VALUES (NULL, '$idea')";
    
    $result = mysql_query($query)
    or die("Query failed: ".mysql_error());
    
    ////////////////////////////////////////////////////////
    
    
    
    
    //Display Ideas on Webpage.
    //Need database code to do this with.
    
    ///////////////////////////////////////////////////////
    //--------------OUTPUT---------------------------------
    ///////////////////////////////////////////////////////
    $query = "SELECT * FROM stan";
    
    $result = mysql_query($query)
    or die("Query failed: " . mysql_error());
    
    
    while ($row = mysql_fetch_assoc($result))
    {
    echo'<table border="1">
    <tr>
    <td>';echo $row["id"];echo'</td>
    <td>';echo $row["idea"]; echo'</td>
    <td><a href="'; echo'http://localhost/';echo'simple.php?id='.$row['id'];echo'>';echo $row["id"]; echo'</a></td>
    </tr>
    </table>
    ';
    
    }
    

  8. Below I will tell you what I need help with.

     

    
    // This reads the file into the array.
    //Do I need a different method right here to put the array into a variable, so 
    //the php and html contents in the file can be created into an another file.
    $lines = file('http://www.talktopixk.com/post.php');
    
    
    
    //Need something to look into the string and replace something in the file string.
    //str_replace replaces a word in a string
    $datastr = str_replace("tablestringdatastring", "test", $lines);
    
    
    
    /////this set of code creates a comment1.php
    
    ///////////////////////////////////////////////////
    $myFile = "comment1.php";
    $fh = fopen($myFile, 'w');
    $myFile = "comment1.php";
    $fh = fopen($myFile, 'w') or die("can't open file");
    ///////////////////////////////////////////////////
    //Write the name of the file.
    
    
    
    $modFile = "comment1.php";
    
    //But in the end this only writes the html contents and it tries to write php contents of the "post.php", but it don't which I want the PHP contents written to comment1.php file.
    Why does it stop writing all of the php contents in the php "post.php" file and how can I 
    can be able to write php and html contents together?
    
    file_put_contents($modFile,$datastr);
    
    fclose($fh);

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