minitauros 151 Junior Poster Featured Poster

In your Javascript console, do you get a confirmation of your AJAX request being executed? If not, apparently something isn't working right. Could you post the lines of your script that we're talking about here?

minitauros 151 Junior Poster Featured Poster

Have you checked your developer console for possible errors? Usually it shows information about what's going wrong - if something is going wrong.

minitauros 151 Junior Poster Featured Poster

If you are still looking for a regex, something like this might work:

/\[url\](?!\[url\])(.*?)\[\/url\]/is

It returns only [url] tags that are not followed by another [url] tag.

minitauros 151 Junior Poster Featured Poster

You could use mysql_real_escape_string() to escape all necessary characters within stuff you insert, I guess. E.g.

INSERT ... VALUES (mysql_real_escape_string($your_value), mysql_real_escape_string($your_value_2)) etc.

minitauros 151 Junior Poster Featured Poster

Maybe the varchar (225) kicks in here. Does the article that you are submitting not exceed the field's maximum storage size (225)?

minitauros 151 Junior Poster Featured Poster

What pritaeas says is (well, what else would you expect) right. To track progress, you'd have to separately select and insert those rows, which would - in this case - probably create an unnecessary delay in your operation.

minitauros 151 Junior Poster Featured Poster

Ok so let's clear this up a little bit. You have a page called index.php. It retrieves data from your database. Now which ID do you want to use on page 2, and how do you get to page 2? Do you get there by submitting a form, clicking a link, something like that?

Using the session to save a variable goes as follows, in case you need to use it:

  1. At the start of your page, place the session_start(); command.

  2. You can now save anything on your page in $_SESSION['your_key_name'], e.g. $_SESSION['user_id'] = $user_id;.

  3. You can now also access session information on your page. Let's say that on a previous page you have saved something in $_SESSION['page_id']. You can now access that variable by simply using $_SESSION['page_id'];, e.g. echo $_SESSION['page_id'];.

minitauros 151 Junior Poster Featured Poster

You could do it in the loop that fetches your DB records. E.g.

<?php
while(...) {
    $website = $record['website'];
    $website = str_replace('$site', $site, $website);
}
minitauros 151 Junior Poster Featured Poster

Index page:

<?php
session_start();
echo '<p>Your session id is: ' . session_id() . '</p>';

Other page:

<?php
session_start();
echo '<p>Your session id is: ' . session_id() . '</p>';

See if they match if you will ;).

minitauros 151 Junior Poster Featured Poster

That is weird, because if the form gets submitted, it is reloaded and $_POST vars should have been filled with the post data.

Could you try to place a print_r($_POST); before the HTML, and see if it gets filled correctly after a form submission?

minitauros 151 Junior Poster Featured Poster

Could you try and replace your HTML part with the following?

<?php
error_reporting(E_ALL ^ E_NOTICE);
?>

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html;" charset="iso-8859-1;">
    <link rel="stylesheet" type="text/css" href="css/style.css" media="screen">
</head>
<body>
    <center>
        <img class="banner" src="image/banner.jpg"></center>
        <div class="button">
        <div class="bcontent">
        <ul class="menu">
        <li class="nvg"><a class="nav" href="index.php">Home</a></li>
        <li class="nvg"><a class="nav" href="">About</a></li>
        </ul>
        </div>
        </div>
        <center>
        <div class="slabel"><center><font face="Malgun Gothic" size="5" color="white"><b><label>Sign Up</label></b></font></center></div>
        <div class="fsignup">
        <form name="register" action="register.php" method="POST">
            <table style="margin-left:10px; padding-top:10px;">
            <tr><td><font color="White" face="Malgun Gothic"><b>Full Name :</b></td>
            <td><input type="text" maxlength="50" size="30" name="name" placeholder="Noreen Nong Musa" value="<?php echo $_POST['name']; ?>" /><br>
            </tr>
            <tr>
            <td style="padding-top:10px;"><font color="White" face="Malgun Gothic"><b>Email :</font></b></td>
            <td style="padding-top:10px;"><input type="text" maxlength="30" size="20" name="email" placeholder="example@example.com" value="<?php echo $_POST['email']; ?>" /></td>
            </tr>
            <tr>
            <td style="padding-top:10px;"><font color="White" face="Malgun Gothic"><b>Password :</font></b></td>
            <td style="padding-top:10px;"><input type="password" maxlength="10" size="20" name="password" placeholder="Password" required /><br></td>
            </tr>
            <tr>
            <td style="padding-top:10px;"><font color="White" face="Malgun Gothic"><b>Confirm Password :</font></b></td>
            <td style="padding-top:10px;"><input type="password" maxlength="10" size="20" name="cpassword" placeholder="Confirm Password" required /><br></td>
            </tr>
            </table>
            <div style="text-align:center; margin-top:50px;">
            <input type="submit" class="signup" value="Sign Up" name="submit">
            </div>
        </form>
        </div>
    </center>
</body>
</html>
minitauros 151 Junior Poster Featured Poster

That's because your error reporting is set to also show notices. $_POST['name'] has not yet been set when you first load the page, thus you get the notice. You can get rid of it by putting this line at the top of your script:

error_reporting(E_ALL ^ E_NOTICE);

Does it display the name correctly though, after you submit the form?

minitauros 151 Junior Poster Featured Poster

I think you should maybe use <?= $_POST['name']; ?> instead of just <?= $name; ?>, as the $name variable hasn't been set yet when PHP arrives at the <form> part.

minitauros 151 Junior Poster Featured Poster

Teamwork :p

minitauros 151 Junior Poster Featured Poster

Hm I don't know about using it in that way, actually, just thought I'd help you out with something of which I know for certain that it works. Are you allowed to declare functions without brackets, by the way? :O

minitauros 151 Junior Poster Featured Poster

Woops, my bad :). Should be && indeed. Don't see why the comparison should be reversed, though.

minitauros 151 Junior Poster Featured Poster

For as far as I know, the css() function only accepts two parameters, being index and value. E.g. you would execute css('width', 420). I'm not completely sure though, but I can provide you with an example of which I'm sure it works:

var new_width = $('#div').width() + 120;
$('#div').css('width', new_width);

Be sure to also check out the innerWidth() and outerWidth() functions! :) Hope this helps!

minitauros 151 Junior Poster Featured Poster

Move the name parameter to the input with type="text", then it should probably work!

<input type="text" name="q"id="searchtxt" />
<input type="submit" id="searchbtn"/>
minitauros 151 Junior Poster Featured Poster

What about:

<?php
if(date('H') > 9 || date('H') < 21) {
    // Show div.
}
minitauros 151 Junior Poster Featured Poster

An example, with you class A (just try to execute it, might clear things up a bit more for you):

<?php
class A
{
    private $private_attribute = 'this is a class attribute, that you can use in any of this class\'s functions';
    public $public_attribute = 'this is a class attribute, that you can use in any of this class\'s functions AND even outside of the class';

    function myFunction()
    {
        $attribute = 'this is an attribute bound to this function; not to this class';

        echo $attribute . '<br>';
        echo $this->private_attribute . '<br>';
        echo $this->public_attribute . '<br>';
    }
}

$class = new A();
$class->myFunction();

// Let's see what happens now:
echo $class->public_attribute . '<br>';
echo $class->private_attribute . '<br>';
minitauros 151 Junior Poster Featured Poster

What's going wrong? :)

minitauros 151 Junior Poster Featured Poster

What about modifying your query just a little bit, to:

SELECT * FROM dbAdd WHERE add_city = '" . mysql_real_escape_string($wil) . "' ORDER BY add_city DESC LIMIT 200

minitauros 151 Junior Poster Featured Poster

Have you tried what has been posted here (StackOverflow)?

minitauros 151 Junior Poster Featured Poster

Your query seems to be incorrect. You should probably not use WHERE $add_city but WHERE add_city (without the $).

Besides that, a COUNT() query might be more efficient here. E.g.:

<?php
$q = 'SELECT COUNT(add_city) AS c FROM dbAdd WHERE add_city = "' . mysql_real_escape_string($wil) . '"';
$rq = mysql_query($q);
$fetch = mysql_fetch_assoc($rq);
$count = $fetch['c'];
minitauros 151 Junior Poster Featured Poster

First of all I think the use of the <marquee> element is waaaay overaged. Second, I think you could solve this problem by adding a CSS style to your <ul>'s <li> elements. Example:

li {
    float: left;
    margin-right: 6px;
}
minitauros 151 Junior Poster Featured Poster

Just curious about your thoughts on this subject.

Example:
www.site.com/?id=1
or
www.site.com/?id=8adyfa8df614812yasdf (which is also "1", but encrypted)

What would you recommend? What do you use? Anyone with pros and/or cons on if you should encrypt your URL data?

My thoughts:
Pros (to encrypting URL data):
- Makes it harder for unwanted people to guess ID's, and thus you will have a safer application.
- Noone will have the real access keys to your data, as long as they don't know how you've encrypted the URL data.

Cons:
- Longer URL's.
- Uglier URL's.
- Need for extra security checking (encryption/decription) on each page of your application.

Considering this, I would say that an application that handles private data could benefit from encrypting URL data, as it adds just an extra bit of security, while for an application that is completely public, it would have no use encrypting URL data (obviously), as everyone has access to the application anyway.

The question that remains is: is it worth going through an extra bit of trouble to provide that extra bit of security?

minitauros 151 Junior Poster Featured Poster

Well, if you need only one record from the tblStudents table, and multiple records from the tblGrades table, I suggest you just perform two queries. The first query will retreive the student info from the tblStudents table. Then, with the studentId that was retrieved, the second query retrieves the student's grades from the tblGrades table. You will have to merge the arrays with PHP or whatever language you are using to display the results. Example:

<?php
$q = 'SELECT StudId,
        LastName,
        FirstName
    FROM tblStudents';

// Let's say the results of that query were stored in $students.
// We will first prepare a query to retrieve each student's grades.
// Guessing and hoping you are using for example PDO or mysqli, you will understand
// the following query (with the questionmark in it).
$q = 'SELECT SubjectCode,
        Grade
    FROM tblGrades
    WHERE StudId = ?
    ORDER BY SubjectCode ASC';

foreach($students as &$student)
{
    // The query is executed here. Let's say the results are stored in $grades.
    // We will add the grades to the current student now:
    $student['grades'] = $grades;
}

// The $students array now contains info about the students and their grades.
echo '<p>Students and grades:</p><pre>'; print_r($students); echo '</pre>';
minitauros 151 Junior Poster Featured Poster

Nope I did not know about that, thank you for the info :). Another solution for this problem hasn't crossed my mind yet, though, unfortunately. Pretty weird that it isn't working as you seem to be doing exactly what the link you just provided describes :o. Have you checked if the script really is included and executed? E.g. maybe you could issue an alert('Wow, this really is IE < 9'); after the createElement() function?

minitauros 151 Junior Poster Featured Poster

I'm not sure but the first thing that comes to my mind is that IE8 is not ready to interpret HTML5 tags like <nav>. Maybe you could find out more about that?

minitauros 151 Junior Poster Featured Poster

You're welcome :). Glad you got it to work.

minitauros 151 Junior Poster Featured Poster

UPDATE saudi_journal SET AU ='' WHERE RID = '3'

This query sets AU to null (removes its value). You should make sure $AU has a value in your script (so that AU = '"$AU"' will actually work) :).

minitauros 151 Junior Poster Featured Poster

Well, have you checked if the variables you are using in your query actually have a value? Does echo-ing your query show anything particular? E.g. what does echo $query; say? Are the variables filled in, or are they empty?

minitauros 151 Junior Poster Featured Poster

Well I guess then you'd have to assign the URL you want to add to a record to a variable, like $url = 'your_url', and then update your database, for example 'UPDATE table_name SET url = "' . mysql_real_escape_string($url) . '" WHERE fill_in_key = "' . mysql_real_escape_string($key) . '" (this looks like your current query).

minitauros 151 Junior Poster Featured Poster

Well, it could be because you're not actually specifying a value to update your record with. You could try this to see if an error is generated. If not, I guess it's your query that is using faulty data.

$RID = $_POST['RID'];
$AU = $_POST['AU'];
$TI = $_POST['TI'];
$SO = $_POST['SO'];

// In your query, $FULTEXT is probably null, or does it get defined somewhere else?
$query = "UPDATE saudi_journal SET FULTEXT = '$FULTEXT' WHERE RID = '$RID'";

echo '<p>The query that was executed, is as follows:<br>' . $query . '</p>';

mysql_query($query);
$error = mysql_error();

if($error)
    echo $error;
else
    echo "<center>Successfully Updated in DATABASE</center>";
minitauros 151 Junior Poster Featured Poster

Woops, my bad :). The first if() statement is not doing a proper check. It should be

if(!$_POST['form_name'])
minitauros 151 Junior Poster Featured Poster

I guess you should check out the fputcsv() function :).

minitauros 151 Junior Poster Featured Poster

Could you replace the last elseif() construction by the following?

elseif($_POST['form_name'] == 'update')
{
    //* The update form has been submitted. Update the database.

    // Let's see if we actually arrive at this part:
    echo '<p>Run the update...</p>';

    $RID = $_POST['RID'];
    $AU = $_POST['AU'];
    $TI = $_POST['TI'];
    $SO = $_POST['SO'];
    $query = "update saudi_journal SET FULTEXT='$FULTEXT' WHERE RID='$RID'";
    mysql_query($query);
    echo "<center>Successfully Updated in DATABASE</center>";
}

And could you add the following line BEFORE the first if() statement?

echo '<p>The following data has been submitted:</p><pre>'; print_r($_POST); echo '</pre>';

It should give you some more info on what is happening, so that you can trace why it's not working as you want it to.

minitauros 151 Junior Poster Featured Poster

Oh I see there is still a if (isset($_POST['submit'])) line in the second elseif() statement. You could remove that - the if() statement that comes a couple of lines earlier should do the work.

Are you getting any errors or is it just not updating?

You don't have to name any of the forms. I have included a hidden <input> in each form, that holds its name. That's what is being checked :).

minitauros 151 Junior Poster Featured Poster

Please read my post carefully again, as I think you might benefit from it in the future. If you have questions about it, feel free to ask! Here's an example of what you could do:

<?php
/***********************************************************************
Create database connection
*/

$db_host="localhost";
$db_name="";
$db_user="";
$db_pass="";
$conn = mysql_connect($db_host, $db_user, $db_pass) or die (mysql_error());

// Select database. Your line - mysql_select_db("$db_name"); - was okay, but you don't need to use
// quotes here :).
mysql_select_db($db_name);


/***********************************************************************
HTML output
*/
?>

<html>
<head>
    <meta name="description" content="Php Code Search & Display Record" />
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>

    <?php
    // Find out which form/action we need to load. I have created some
    // hidden input fields to help identifying the forms.
    if(!$_POST['search'])
    {
        //* No search query has been submitted yet. Display the search form.
        ?>

        <form name="search" method="post" action="search.php">
            <input type="hidden" name="form_name" value="search">
            <table style=" border:1px solid silver" cellpadding="5px" cellspacing="0px" align="center" border="0">
                <tr>
                    <td colspan="3" style="background:#0066FF; color:#FFFFFF; fontsize: 20px">
                        Search
                    </td>
                </tr>
                <tr>
                    <td width="140">Enter Search Keyword</td>
                    <td width="240"><input type="text" name="search" size="40" /></td>
                    <td width="665"><input type="submit" value="Search" /></td>
                </tr>
                <tr bgcolor="#666666" style="color:#FFFFFF">
                    <td>Record ID</td>
                    <td>Description</td>
                    <td> </td>
                </tr>
            </table>
        </form>

        <?php
    }
    elseif($_POST['form_name'] == 'search' && $_POST['search'])
    {
        //* The search form has been submitted. Display the update form(s).
        $search = $_POST["search"];
        $result = mysql_query("SELECT * FROM saudi_journal WHERE SO like '%$search%'")or die(mysql_error());

        while($row = mysql_fetch_array($result))
        {
            ?>
            <form action="search.php" method="post">
                <input type="hidden" name="form_name" value="update">
                <input type="text" name="RID" value="<?php echo $row['RID'];?>" size=6>
                Author
                <input type="text" name="author" value="<?php echo $row['AU'];?>">
                Title …
minitauros 151 Junior Poster Featured Poster

I would like to suggest a (in my opinion) cleaner solution :). This solution is as follows:

  1. Create a database file, in which you create your database connection, etc. You can include that file in every file that you need a database connection in. This way, you don't need to modify your database connection related code in every file if you once decide to change your database info. You can include a file using PHP's include(), include_once(), require() or require_once() functions. Look them up on php.net ;).

  2. I myself like to have separate files for each action/process, but in this particular situation, I guess you could have 2 forms on one page, and have the one that matches the action (e.g. update) be shown. That would go, for example, as follows (this is actually pretty much the same as vipula suggests):

    <?php
    // Include the file that manages your database connection.
    include('includes/database_connection.php');
    
    // Find out if we need to display the search form or the update form.
    if($_POST['search'])
    {
        //* A search query has been given. Display the update form.
    
        // Perform queries.
        $query = 'SELECT ...';
        // etc..
        ?>
    
        <form>
            <!-- Display your HTML stuff here... -->
        </form>
    
        <?php
    }
    else
    {
        //* A search query wasn't given. Display the search form.
    
        // Perform queries.
        $query = '';
        // etc...
        ?>
    
        <form>
            <!-- Display your HTML stuff here... -->
        </form>
    
        <?php
    }
    
minitauros 151 Junior Poster Featured Poster

What do you have so far? :) Usually it goes something like:

SELECT * 
FROM table_name
WHERE created = "2013-12-11"
minitauros 151 Junior Poster Featured Poster

You must select a database using the mysql_select_db() function. So, replace this line

$con = mysql_connect($host, $username, $password, $db_name);

by the following

$con = mysql_connect($host, $username, $password);
mysql_select_db($db_name, $con);

Note, however, that PHP's mysql_* functions will be deprecated in the future, and that any further use of it is disencouraged.

minitauros 151 Junior Poster Featured Poster

Yea. Because if you just call the PHP script that is pinging, it will wait untill all pinging is done and return everything at once. If you make each ping write a line to a text file for example, you could then check that text file very 0.5 seconds or so to check if any new lines have been added, and display those.

minitauros 151 Junior Poster Featured Poster

Maybe your PHP installation does not support shortcodes. You could try using

Second<input type="text" name="text2" value="<?php echo $var2; ?>" disabled><br>

instead of

Second<input type="text" name="text2" value="<? echo $var2; ?>" disabled><br>

minitauros 151 Junior Poster Featured Poster

First thing that comes to mind:

Make the PHP script that does the pinging (ping.php) write its results to, for example, ping_results.txt. Then, make an AJAX call to ping.php and immediatelty after execute a Javascript timeout that executes an AJAX function every 0.5 or 1 seconds, which opens ping_results.txt and outputs the results.

minitauros 151 Junior Poster Featured Poster

I suppose something like this should work:

$_SESSON['username'] =  $result[0]['username'];
$_SESSON['fullname'] =  $result[0]['fullname'];
minitauros 151 Junior Poster Featured Poster

Well I wouldn't know the downside of it right now, but it just feels somewhat off to me to use contenteditable divs for stuff that I usually use inputs and textareas for. Anyway, glad your problem has been solved ;).

minitauros 151 Junior Poster Featured Poster

I haven't done this with editable <div>s before, but usually you get a div's content by using div.innerHTML, not div.value. So changing your code to

function maths()
{
    var qt = document.getElementById("quantity1").innerHTML;
    var up = document.getElementById("unitprice1").innerHTML;
    qtup = parseFloat((qt * up)) || 0;
    document.getElementById("total1").innerHTML = qtup;
}

might work. Why are you using editable <div>s instead of just inputs? :o

minitauros 151 Junior Poster Featured Poster

I think you could add

RewriteRule ^product.php/([a-zA-Z0-9]+)$ product.php?id=$1

to get that working. Or you could use this:

RewriteEngine on

Options -Indexes

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L]

to redirect everything to your index page, and then use $_SERVER['REQUEST_URI'] to parse the URI and load the appropriate files.

minitauros 151 Junior Poster Featured Poster

I guess that by "certifications" they mean something like "which languages have you proven yourself certified to program in?". So I guess you could fill in the languages you have a lot of experience with?