Life, the Internet, and Everything!

PHP/MYSQL String Tricks

Here’s a couple things I always forget. I’m adding them here so I’ll have them for future reference.

How to “Scan and Replace” a String in MYSQL

(Note the AS400-ish wording of that title).

Big Note: Be very careful of serialized data!!!!

Thanks to http://www.mydigitallife.info/how-to-find-and-replace-text-in-mysql-database-using-sql/ for these little pieces of code.

The syntax of REPLACE is REPLACE(text_string, from_string, to_string)

Like this:

update TABLE_NAME set FIELD_NAME = replace(FIELD_NAME, 'find this string', 'replace found string with this string');

update wp_posts set post_content = replace(post_content, 'http://domain.com/blog/', 'http://domain.com/')

The above statement will replace all instances of 'http://domain.com/blog' to 'http://domain.com/' in the field of post_content of wp_posts table.

(I actually used the code above to “transfer” a bunch of image referencess from a WordPress install in a folder up to the root domain).

How to Search for a String in an Entire MYSQL Database

After doing “scans and replaces” it may be necessary to check your work. Here’s the trick.

Log into PHPMYADMIN and highlight (select) the entire database. Click search. You will see a screen something like this:

You must put in your SQL-syntax wildcard and select the tables to search. Click Go, and you’ll see:

You’re done.

 

Tags: , , , , , , ,
Previous Post
Boise State

Go, Go, Go Joe Southwick

Next Post
Technology

Marissa Mayer: Saving Yahoo?

Comments

    • Billy29815
    • December 5, 2013
    Reply

    How To Make My Website Automatically Create Pages? I know php,mysql,html ect… I just am not sure on how to do this…

    When you go to http://www.youtube.com and submitt a video, you get a url with the video on this.

    When you go to craigslist and make a post, you get a url with your post on it…

    I’m trying to find out how i can set this up for my website. So when people create a post, It make make a URL for it..

    Anyone know a guide on how to do this?

    View Comment
    1. Reply

      They typically do NOT create a new page for the content dynamically. Instead, the information pertaining to that particular data is stored in a database. They use queries in the URL in order to display the data for a specific item.

      For example, on YouTube you see something like the following:

      The “watch” is the page which handles the data. Notice how practically every video’s page (for standard users) looks just like the rest, except the video and related videos and comments and such are different. That’s because “watch” is like a “master page”.

      The “watch” page looks at “v=aBcDEfGhijK”. It looks for the value of ‘v’ and pulls the information for the video with ID ‘aBcDEfGhijK’ from the database. It then displays the relevant information.

      Craigslist appears to create a page for each entry. However, that could very well be a simple “trick” known as “URL Shortening”. URL Shortening functions the same way that “page?param=value” URL’s work but they are displayed differently.

      If you do still wish to create a page for each new item, however, it is still quite simple. All you need is a “master” page for items. We’ll use that page as a template for new items. Now, when you receive a new item, you simply copy the template file (e.g. itemtemplate.html) to the item’s destination directory, changing the name in the process (e.g. itemone.html). Then, using a server-side language such as PHP or ASP .NET, you would simply “insert” the item’s data into the file.

      In the template file you should place something like “{ItemDescriptionPlaceholder}” where the item’s description should go. When you “insert” the item’s description you would use a string replace method like so:

      itemtemplateText.Replace(“{ItemDescriptionPlaceholder}”, newItemDescription”)

      I hope this all makes sense.

      View Comment
    • ArseOrange
    • December 23, 2013
    Reply

    Can Someone Help With HTML/PHP/MySQL? I’m having an issue with inputting data stored in a PHP variable into a HTML form, using the value property in the tag. The problem seems to be that strings are being cut around spaces, where only the first part of the string before the space making it to the form. Strings without spaces appear with a forward slash at the end.

    The idea for the form is that a customer could edit the details store about them on a MySQL database, and then changing the values with an update statement. So it’s really important that the values appear as they are stored in the PHP variables.

    Thanks in advance for any help, my teacher is proving increasingly useless.
    ~J

    (I can post code/screencaps if that would help)
    < ?php //session start// session_start(); //Connect to the server and database// $con=mysqli_connect("127.0.0.1","root","","mia"); //Generate the sql statement for retrieval of customer details// $customerdetails="SELECT Name, BusinessName, Address, Postcode, TelNo, Email FROM customer WHERE CustomerID = " . $_SESSION['CustomerID'] . ""; //execute the 'Customer details retrieve' sql statement// $result= mysqli_query($con, $customerdetails); while ($row = mysqli_fetch_array($result)) { $Name='' . $row['Name'] . ''; $BusinessName=$row['BusinessName']; $Addresss=$row['Address']; $Postcode=$row['Postcode']; $TelNo=$row['TelNo']; $Email=$row['Email']; } //Write the web page// echo "


    <br /> Edit Details<br />



    <br /> Edit Details<br />

    Edit Details

    Please change values below where apropriate


    Name:
    Business Name:
    Address:
    Post Code:
    Telephone No:

    Email Address:

    ” . $Name . “

    ” . $_SESSION[‘CustomerID’] . “


    “;

    ?>
    Apologies if I have misunderstood. I copy/pasted the example you gave me, and the form entry read “< ?php echo $Email;?>“.
    Also, the editor butchered the code, thus i had to split into chunks… messy to say the least.

    http://i.imgur.com/pvfYApy.png
    ^screencap of the issue i’m having

    View Comment
      • Admin
      • December 23, 2013
      Reply

      You are screwing It up right here, run this example:

      < ?php $Email = "example@google.com"; echo " “;

      ?>

      To solve this, just add two apostrophes, like the following:

      echo “ “;

      It will do the trick.

      See how we can make pathetic mistakes sometimes? Next time, I will say again: make It simpler.

      ——————-

      To make things simpler, you could also use the heredoc syntax:

      http://php.net/manual/en/language.types.string.php

      ——————-
      Take this example and run It:

      < ?php $Email = "example@google.com"; ?>

      Edit your e-mail:
      View Comment
    • Billy29815
    • January 7, 2014
    Reply

    How To Make My Website Automatically Create Pages? I know php,mysql,html ect… I just am not sure on how to do this…

    When you go to http://www.youtube.com and submitt a video, you get a url with the video on this.

    When you go to craigslist and make a post, you get a url with your post on it…

    I’m trying to find out how i can set this up for my website. So when people create a post, It make make a URL for it..

    Anyone know a guide on how to do this?

    View Comment
    1. Reply

      They typically do NOT create a new page for the content dynamically. Instead, the information pertaining to that particular data is stored in a database. They use queries in the URL in order to display the data for a specific item.

      For example, on YouTube you see something like the following:

      The “watch” is the page which handles the data. Notice how practically every video’s page (for standard users) looks just like the rest, except the video and related videos and comments and such are different. That’s because “watch” is like a “master page”.

      The “watch” page looks at “v=aBcDEfGhijK”. It looks for the value of ‘v’ and pulls the information for the video with ID ‘aBcDEfGhijK’ from the database. It then displays the relevant information.

      Craigslist appears to create a page for each entry. However, that could very well be a simple “trick” known as “URL Shortening”. URL Shortening functions the same way that “page?param=value” URL’s work but they are displayed differently.

      If you do still wish to create a page for each new item, however, it is still quite simple. All you need is a “master” page for items. We’ll use that page as a template for new items. Now, when you receive a new item, you simply copy the template file (e.g. itemtemplate.html) to the item’s destination directory, changing the name in the process (e.g. itemone.html). Then, using a server-side language such as PHP or ASP .NET, you would simply “insert” the item’s data into the file.

      In the template file you should place something like “{ItemDescriptionPlaceholder}” where the item’s description should go. When you “insert” the item’s description you would use a string replace method like so:

      itemtemplateText.Replace(“{ItemDescriptionPlaceholder}”, newItemDescription”)

      I hope this all makes sense.

      View Comment
    • Billy29815
    • January 14, 2014
    Reply

    How To Make My Website Automatically Create Pages? I know php,mysql,html ect… I just am not sure on how to do this…

    When you go to http://www.youtube.com and submitt a video, you get a url with the video on this.

    When you go to craigslist and make a post, you get a url with your post on it…

    I’m trying to find out how i can set this up for my website. So when people create a post, It make make a URL for it..

    Anyone know a guide on how to do this?

    View Comment
    1. Reply

      They typically do NOT create a new page for the content dynamically. Instead, the information pertaining to that particular data is stored in a database. They use queries in the URL in order to display the data for a specific item.

      For example, on YouTube you see something like the following:

      The “watch” is the page which handles the data. Notice how practically every video’s page (for standard users) looks just like the rest, except the video and related videos and comments and such are different. That’s because “watch” is like a “master page”.

      The “watch” page looks at “v=aBcDEfGhijK”. It looks for the value of ‘v’ and pulls the information for the video with ID ‘aBcDEfGhijK’ from the database. It then displays the relevant information.

      Craigslist appears to create a page for each entry. However, that could very well be a simple “trick” known as “URL Shortening”. URL Shortening functions the same way that “page?param=value” URL’s work but they are displayed differently.

      If you do still wish to create a page for each new item, however, it is still quite simple. All you need is a “master” page for items. We’ll use that page as a template for new items. Now, when you receive a new item, you simply copy the template file (e.g. itemtemplate.html) to the item’s destination directory, changing the name in the process (e.g. itemone.html). Then, using a server-side language such as PHP or ASP .NET, you would simply “insert” the item’s data into the file.

      In the template file you should place something like “{ItemDescriptionPlaceholder}” where the item’s description should go. When you “insert” the item’s description you would use a string replace method like so:

      itemtemplateText.Replace(“{ItemDescriptionPlaceholder}”, newItemDescription”)

      I hope this all makes sense.

      View Comment
    • Billy29815
    • January 26, 2014
    Reply

    How To Make My Website Automatically Create Pages? I know php,mysql,html ect… I just am not sure on how to do this…

    When you go to http://www.youtube.com and submitt a video, you get a url with the video on this.

    When you go to craigslist and make a post, you get a url with your post on it…

    I’m trying to find out how i can set this up for my website. So when people create a post, It make make a URL for it..

    Anyone know a guide on how to do this?

    View Comment
    1. Reply

      They typically do NOT create a new page for the content dynamically. Instead, the information pertaining to that particular data is stored in a database. They use queries in the URL in order to display the data for a specific item.

      For example, on YouTube you see something like the following:

      The “watch” is the page which handles the data. Notice how practically every video’s page (for standard users) looks just like the rest, except the video and related videos and comments and such are different. That’s because “watch” is like a “master page”.

      The “watch” page looks at “v=aBcDEfGhijK”. It looks for the value of ‘v’ and pulls the information for the video with ID ‘aBcDEfGhijK’ from the database. It then displays the relevant information.

      Craigslist appears to create a page for each entry. However, that could very well be a simple “trick” known as “URL Shortening”. URL Shortening functions the same way that “page?param=value” URL’s work but they are displayed differently.

      If you do still wish to create a page for each new item, however, it is still quite simple. All you need is a “master” page for items. We’ll use that page as a template for new items. Now, when you receive a new item, you simply copy the template file (e.g. itemtemplate.html) to the item’s destination directory, changing the name in the process (e.g. itemone.html). Then, using a server-side language such as PHP or ASP .NET, you would simply “insert” the item’s data into the file.

      In the template file you should place something like “{ItemDescriptionPlaceholder}” where the item’s description should go. When you “insert” the item’s description you would use a string replace method like so:

      itemtemplateText.Replace(“{ItemDescriptionPlaceholder}”, newItemDescription”)

      I hope this all makes sense.

      View Comment
    • ArseOrange
    • February 2, 2014
    Reply

    Can Someone Help With HTML/PHP/MySQL? I’m having an issue with inputting data stored in a PHP variable into a HTML form, using the value property in the tag. The problem seems to be that strings are being cut around spaces, where only the first part of the string before the space making it to the form. Strings without spaces appear with a forward slash at the end.

    The idea for the form is that a customer could edit the details store about them on a MySQL database, and then changing the values with an update statement. So it’s really important that the values appear as they are stored in the PHP variables.

    Thanks in advance for any help, my teacher is proving increasingly useless.
    ~J

    (I can post code/screencaps if that would help)
    < ?php //session start// session_start(); //Connect to the server and database// $con=mysqli_connect("127.0.0.1","root","","mia"); //Generate the sql statement for retrieval of customer details// $customerdetails="SELECT Name, BusinessName, Address, Postcode, TelNo, Email FROM customer WHERE CustomerID = " . $_SESSION['CustomerID'] . ""; //execute the 'Customer details retrieve' sql statement// $result= mysqli_query($con, $customerdetails); while ($row = mysqli_fetch_array($result)) { $Name='' . $row['Name'] . ''; $BusinessName=$row['BusinessName']; $Addresss=$row['Address']; $Postcode=$row['Postcode']; $TelNo=$row['TelNo']; $Email=$row['Email']; } //Write the web page// echo "


    <br /> Edit Details<br />



    <br /> Edit Details<br />

    Edit Details

    Please change values below where apropriate


    Name:
    Business Name:
    Address:
    Post Code:
    Telephone No:

    Email Address:

    ” . $Name . “

    ” . $_SESSION[‘CustomerID’] . “


    “;

    ?>
    Apologies if I have misunderstood. I copy/pasted the example you gave me, and the form entry read “< ?php echo $Email;?>“.
    Also, the editor butchered the code, thus i had to split into chunks… messy to say the least.

    http://i.imgur.com/pvfYApy.png
    ^screencap of the issue i’m having

    View Comment
    1. Reply

      You are screwing It up right here, run this example:

      < ?php $Email = "example@google.com"; echo " “;

      ?>

      To solve this, just add two apostrophes, like the following:

      echo “ “;

      It will do the trick.

      See how we can make pathetic mistakes sometimes? Next time, I will say again: make It simpler.

      ——————-

      To make things simpler, you could also use the heredoc syntax:

      http://php.net/manual/en/language.types.string.php

      ——————-
      Take this example and run It:

      < ?php $Email = "example@google.com"; ?>

      Edit your e-mail:
      View Comment
    • ArseOrange
    • February 23, 2014
    Reply

    Can Someone Help With HTML/PHP/MySQL? I’m having an issue with inputting data stored in a PHP variable into a HTML form, using the value property in the tag. The problem seems to be that strings are being cut around spaces, where only the first part of the string before the space making it to the form. Strings without spaces appear with a forward slash at the end.

    The idea for the form is that a customer could edit the details store about them on a MySQL database, and then changing the values with an update statement. So it’s really important that the values appear as they are stored in the PHP variables.

    Thanks in advance for any help, my teacher is proving increasingly useless.
    ~J

    (I can post code/screencaps if that would help)
    < ?php //session start// session_start(); //Connect to the server and database// $con=mysqli_connect("127.0.0.1","root","","mia"); //Generate the sql statement for retrieval of customer details// $customerdetails="SELECT Name, BusinessName, Address, Postcode, TelNo, Email FROM customer WHERE CustomerID = " . $_SESSION['CustomerID'] . ""; //execute the 'Customer details retrieve' sql statement// $result= mysqli_query($con, $customerdetails); while ($row = mysqli_fetch_array($result)) { $Name='' . $row['Name'] . ''; $BusinessName=$row['BusinessName']; $Addresss=$row['Address']; $Postcode=$row['Postcode']; $TelNo=$row['TelNo']; $Email=$row['Email']; } //Write the web page// echo "


    <br /> Edit Details<br />



    <br /> Edit Details<br />

    Edit Details

    Please change values below where apropriate


    Name:
    Business Name:
    Address:
    Post Code:
    Telephone No:

    Email Address:

    ” . $Name . “

    ” . $_SESSION[‘CustomerID’] . “


    “;

    ?>
    Apologies if I have misunderstood. I copy/pasted the example you gave me, and the form entry read “< ?php echo $Email;?>“.
    Also, the editor butchered the code, thus i had to split into chunks… messy to say the least.

    http://i.imgur.com/pvfYApy.png
    ^screencap of the issue i’m having

    View Comment
      • Admin
      • February 23, 2014
      Reply

      You are screwing It up right here, run this example:

      < ?php $Email = "example@google.com"; echo " “;

      ?>

      To solve this, just add two apostrophes, like the following:

      echo “ “;

      It will do the trick.

      See how we can make pathetic mistakes sometimes? Next time, I will say again: make It simpler.

      ——————-

      To make things simpler, you could also use the heredoc syntax:

      http://php.net/manual/en/language.types.string.php

      ——————-
      Take this example and run It:

      < ?php $Email = "example@google.com"; ?>

      Edit your e-mail:
      View Comment
    • Billy29815
    • March 4, 2014
    Reply

    How To Make My Website Automatically Create Pages? I know php,mysql,html ect… I just am not sure on how to do this…

    When you go to http://www.youtube.com and submitt a video, you get a url with the video on this.

    When you go to craigslist and make a post, you get a url with your post on it…

    I’m trying to find out how i can set this up for my website. So when people create a post, It make make a URL for it..

    Anyone know a guide on how to do this?

    View Comment
    1. Reply

      They typically do NOT create a new page for the content dynamically. Instead, the information pertaining to that particular data is stored in a database. They use queries in the URL in order to display the data for a specific item.

      For example, on YouTube you see something like the following:

      The “watch” is the page which handles the data. Notice how practically every video’s page (for standard users) looks just like the rest, except the video and related videos and comments and such are different. That’s because “watch” is like a “master page”.

      The “watch” page looks at “v=aBcDEfGhijK”. It looks for the value of ‘v’ and pulls the information for the video with ID ‘aBcDEfGhijK’ from the database. It then displays the relevant information.

      Craigslist appears to create a page for each entry. However, that could very well be a simple “trick” known as “URL Shortening”. URL Shortening functions the same way that “page?param=value” URL’s work but they are displayed differently.

      If you do still wish to create a page for each new item, however, it is still quite simple. All you need is a “master” page for items. We’ll use that page as a template for new items. Now, when you receive a new item, you simply copy the template file (e.g. itemtemplate.html) to the item’s destination directory, changing the name in the process (e.g. itemone.html). Then, using a server-side language such as PHP or ASP .NET, you would simply “insert” the item’s data into the file.

      In the template file you should place something like “{ItemDescriptionPlaceholder}” where the item’s description should go. When you “insert” the item’s description you would use a string replace method like so:

      itemtemplateText.Replace(“{ItemDescriptionPlaceholder}”, newItemDescription”)

      I hope this all makes sense.

      View Comment
    • ArseOrange
    • March 6, 2014
    Reply

    Can Someone Help With HTML/PHP/MySQL? I’m having an issue with inputting data stored in a PHP variable into a HTML form, using the value property in the tag. The problem seems to be that strings are being cut around spaces, where only the first part of the string before the space making it to the form. Strings without spaces appear with a forward slash at the end.

    The idea for the form is that a customer could edit the details store about them on a MySQL database, and then changing the values with an update statement. So it’s really important that the values appear as they are stored in the PHP variables.

    Thanks in advance for any help, my teacher is proving increasingly useless.
    ~J

    (I can post code/screencaps if that would help)
    < ?php //session start// session_start(); //Connect to the server and database// $con=mysqli_connect("127.0.0.1","root","","mia"); //Generate the sql statement for retrieval of customer details// $customerdetails="SELECT Name, BusinessName, Address, Postcode, TelNo, Email FROM customer WHERE CustomerID = " . $_SESSION['CustomerID'] . ""; //execute the 'Customer details retrieve' sql statement// $result= mysqli_query($con, $customerdetails); while ($row = mysqli_fetch_array($result)) { $Name='' . $row['Name'] . ''; $BusinessName=$row['BusinessName']; $Addresss=$row['Address']; $Postcode=$row['Postcode']; $TelNo=$row['TelNo']; $Email=$row['Email']; } //Write the web page// echo "


    <br /> Edit Details<br />



    <br /> Edit Details<br />

    Edit Details

    Please change values below where apropriate


    Name:
    Business Name:
    Address:
    Post Code:
    Telephone No:

    Email Address:

    ” . $Name . “

    ” . $_SESSION[‘CustomerID’] . “


    “;

    ?>
    Apologies if I have misunderstood. I copy/pasted the example you gave me, and the form entry read “< ?php echo $Email;?>“.
    Also, the editor butchered the code, thus i had to split into chunks… messy to say the least.

    http://i.imgur.com/pvfYApy.png
    ^screencap of the issue i’m having

    View Comment
    1. Reply

      You are screwing It up right here, run this example:

      < ?php $Email = "example@google.com"; echo " “;

      ?>

      To solve this, just add two apostrophes, like the following:

      echo “ “;

      It will do the trick.

      See how we can make pathetic mistakes sometimes? Next time, I will say again: make It simpler.

      ——————-

      To make things simpler, you could also use the heredoc syntax:

      http://php.net/manual/en/language.types.string.php

      ——————-
      Take this example and run It:

      < ?php $Email = "example@google.com"; ?>

      Edit your e-mail:
      View Comment
    • Billy29815
    • March 18, 2014
    Reply

    How To Make My Website Automatically Create Pages? I know php,mysql,html ect… I just am not sure on how to do this…

    When you go to http://www.youtube.com and submitt a video, you get a url with the video on this.

    When you go to craigslist and make a post, you get a url with your post on it…

    I’m trying to find out how i can set this up for my website. So when people create a post, It make make a URL for it..

    Anyone know a guide on how to do this?

    View Comment
    1. Reply

      They typically do NOT create a new page for the content dynamically. Instead, the information pertaining to that particular data is stored in a database. They use queries in the URL in order to display the data for a specific item.

      For example, on YouTube you see something like the following:

      The “watch” is the page which handles the data. Notice how practically every video’s page (for standard users) looks just like the rest, except the video and related videos and comments and such are different. That’s because “watch” is like a “master page”.

      The “watch” page looks at “v=aBcDEfGhijK”. It looks for the value of ‘v’ and pulls the information for the video with ID ‘aBcDEfGhijK’ from the database. It then displays the relevant information.

      Craigslist appears to create a page for each entry. However, that could very well be a simple “trick” known as “URL Shortening”. URL Shortening functions the same way that “page?param=value” URL’s work but they are displayed differently.

      If you do still wish to create a page for each new item, however, it is still quite simple. All you need is a “master” page for items. We’ll use that page as a template for new items. Now, when you receive a new item, you simply copy the template file (e.g. itemtemplate.html) to the item’s destination directory, changing the name in the process (e.g. itemone.html). Then, using a server-side language such as PHP or ASP .NET, you would simply “insert” the item’s data into the file.

      In the template file you should place something like “{ItemDescriptionPlaceholder}” where the item’s description should go. When you “insert” the item’s description you would use a string replace method like so:

      itemtemplateText.Replace(“{ItemDescriptionPlaceholder}”, newItemDescription”)

      I hope this all makes sense.

      View Comment
    • Billy29815
    • March 20, 2014
    Reply

    How To Make My Website Automatically Create Pages? I know php,mysql,html ect… I just am not sure on how to do this…

    When you go to http://www.youtube.com and submitt a video, you get a url with the video on this.

    When you go to craigslist and make a post, you get a url with your post on it…

    I’m trying to find out how i can set this up for my website. So when people create a post, It make make a URL for it..

    Anyone know a guide on how to do this?

    View Comment
    1. Reply

      They typically do NOT create a new page for the content dynamically. Instead, the information pertaining to that particular data is stored in a database. They use queries in the URL in order to display the data for a specific item.

      For example, on YouTube you see something like the following:

      The “watch” is the page which handles the data. Notice how practically every video’s page (for standard users) looks just like the rest, except the video and related videos and comments and such are different. That’s because “watch” is like a “master page”.

      The “watch” page looks at “v=aBcDEfGhijK”. It looks for the value of ‘v’ and pulls the information for the video with ID ‘aBcDEfGhijK’ from the database. It then displays the relevant information.

      Craigslist appears to create a page for each entry. However, that could very well be a simple “trick” known as “URL Shortening”. URL Shortening functions the same way that “page?param=value” URL’s work but they are displayed differently.

      If you do still wish to create a page for each new item, however, it is still quite simple. All you need is a “master” page for items. We’ll use that page as a template for new items. Now, when you receive a new item, you simply copy the template file (e.g. itemtemplate.html) to the item’s destination directory, changing the name in the process (e.g. itemone.html). Then, using a server-side language such as PHP or ASP .NET, you would simply “insert” the item’s data into the file.

      In the template file you should place something like “{ItemDescriptionPlaceholder}” where the item’s description should go. When you “insert” the item’s description you would use a string replace method like so:

      itemtemplateText.Replace(“{ItemDescriptionPlaceholder}”, newItemDescription”)

      I hope this all makes sense.

      View Comment
    • ArseOrange
    • March 24, 2014
    Reply

    Can Someone Help With HTML/PHP/MySQL? I’m having an issue with inputting data stored in a PHP variable into a HTML form, using the value property in the tag. The problem seems to be that strings are being cut around spaces, where only the first part of the string before the space making it to the form. Strings without spaces appear with a forward slash at the end.

    The idea for the form is that a customer could edit the details store about them on a MySQL database, and then changing the values with an update statement. So it’s really important that the values appear as they are stored in the PHP variables.

    Thanks in advance for any help, my teacher is proving increasingly useless.
    ~J

    (I can post code/screencaps if that would help)
    < ?php //session start// session_start(); //Connect to the server and database// $con=mysqli_connect("127.0.0.1","root","","mia"); //Generate the sql statement for retrieval of customer details// $customerdetails="SELECT Name, BusinessName, Address, Postcode, TelNo, Email FROM customer WHERE CustomerID = " . $_SESSION['CustomerID'] . ""; //execute the 'Customer details retrieve' sql statement// $result= mysqli_query($con, $customerdetails); while ($row = mysqli_fetch_array($result)) { $Name='' . $row['Name'] . ''; $BusinessName=$row['BusinessName']; $Addresss=$row['Address']; $Postcode=$row['Postcode']; $TelNo=$row['TelNo']; $Email=$row['Email']; } //Write the web page// echo "


    <br /> Edit Details<br />



    <br /> Edit Details<br />

    Edit Details

    Please change values below where apropriate


    Name:
    Business Name:
    Address:
    Post Code:
    Telephone No:

    Email Address:

    ” . $Name . “

    ” . $_SESSION[‘CustomerID’] . “


    “;

    ?>
    Apologies if I have misunderstood. I copy/pasted the example you gave me, and the form entry read “< ?php echo $Email;?>“.
    Also, the editor butchered the code, thus i had to split into chunks… messy to say the least.

    http://i.imgur.com/pvfYApy.png
    ^screencap of the issue i’m having

    View Comment
    1. Reply

      You are screwing It up right here, run this example:

      < ?php $Email = "example@google.com"; echo " “;

      ?>

      To solve this, just add two apostrophes, like the following:

      echo “ “;

      It will do the trick.

      See how we can make pathetic mistakes sometimes? Next time, I will say again: make It simpler.

      ——————-

      To make things simpler, you could also use the heredoc syntax:

      http://php.net/manual/en/language.types.string.php

      ——————-
      Take this example and run It:

      < ?php $Email = "example@google.com"; ?>

      Edit your e-mail:
      View Comment
    • ArseOrange
    • April 17, 2014
    Reply

    Can Someone Help With HTML/PHP/MySQL? I’m having an issue with inputting data stored in a PHP variable into a HTML form, using the value property in the tag. The problem seems to be that strings are being cut around spaces, where only the first part of the string before the space making it to the form. Strings without spaces appear with a forward slash at the end.

    The idea for the form is that a customer could edit the details store about them on a MySQL database, and then changing the values with an update statement. So it’s really important that the values appear as they are stored in the PHP variables.

    Thanks in advance for any help, my teacher is proving increasingly useless.
    ~J

    (I can post code/screencaps if that would help)
    < ?php //session start// session_start(); //Connect to the server and database// $con=mysqli_connect("127.0.0.1","root","","mia"); //Generate the sql statement for retrieval of customer details// $customerdetails="SELECT Name, BusinessName, Address, Postcode, TelNo, Email FROM customer WHERE CustomerID = " . $_SESSION['CustomerID'] . ""; //execute the 'Customer details retrieve' sql statement// $result= mysqli_query($con, $customerdetails); while ($row = mysqli_fetch_array($result)) { $Name='' . $row['Name'] . ''; $BusinessName=$row['BusinessName']; $Addresss=$row['Address']; $Postcode=$row['Postcode']; $TelNo=$row['TelNo']; $Email=$row['Email']; } //Write the web page// echo "


    <br /> Edit Details<br />



    <br /> Edit Details<br />

    Edit Details

    Please change values below where apropriate


    Name:
    Business Name:
    Address:
    Post Code:
    Telephone No:

    Email Address:

    ” . $Name . “

    ” . $_SESSION[‘CustomerID’] . “


    “;

    ?>
    Apologies if I have misunderstood. I copy/pasted the example you gave me, and the form entry read “< ?php echo $Email;?>“.
    Also, the editor butchered the code, thus i had to split into chunks… messy to say the least.

    http://i.imgur.com/pvfYApy.png
    ^screencap of the issue i’m having

    View Comment
    1. Reply

      You are screwing It up right here, run this example:

      < ?php $Email = "example@google.com"; echo " “;

      ?>

      To solve this, just add two apostrophes, like the following:

      echo “ “;

      It will do the trick.

      See how we can make pathetic mistakes sometimes? Next time, I will say again: make It simpler.

      ——————-

      To make things simpler, you could also use the heredoc syntax:

      http://php.net/manual/en/language.types.string.php

      ——————-
      Take this example and run It:

      < ?php $Email = "example@google.com"; ?>

      Edit your e-mail:
      View Comment
    • Billy29815
    • April 17, 2014
    Reply

    How To Make My Website Automatically Create Pages? I know php,mysql,html ect… I just am not sure on how to do this…

    When you go to http://www.youtube.com and submitt a video, you get a url with the video on this.

    When you go to craigslist and make a post, you get a url with your post on it…

    I’m trying to find out how i can set this up for my website. So when people create a post, It make make a URL for it..

    Anyone know a guide on how to do this?

    View Comment
    1. Reply

      They typically do NOT create a new page for the content dynamically. Instead, the information pertaining to that particular data is stored in a database. They use queries in the URL in order to display the data for a specific item.

      For example, on YouTube you see something like the following:

      The “watch” is the page which handles the data. Notice how practically every video’s page (for standard users) looks just like the rest, except the video and related videos and comments and such are different. That’s because “watch” is like a “master page”.

      The “watch” page looks at “v=aBcDEfGhijK”. It looks for the value of ‘v’ and pulls the information for the video with ID ‘aBcDEfGhijK’ from the database. It then displays the relevant information.

      Craigslist appears to create a page for each entry. However, that could very well be a simple “trick” known as “URL Shortening”. URL Shortening functions the same way that “page?param=value” URL’s work but they are displayed differently.

      If you do still wish to create a page for each new item, however, it is still quite simple. All you need is a “master” page for items. We’ll use that page as a template for new items. Now, when you receive a new item, you simply copy the template file (e.g. itemtemplate.html) to the item’s destination directory, changing the name in the process (e.g. itemone.html). Then, using a server-side language such as PHP or ASP .NET, you would simply “insert” the item’s data into the file.

      In the template file you should place something like “{ItemDescriptionPlaceholder}” where the item’s description should go. When you “insert” the item’s description you would use a string replace method like so:

      itemtemplateText.Replace(“{ItemDescriptionPlaceholder}”, newItemDescription”)

      I hope this all makes sense.

      View Comment
    • ArseOrange
    • May 21, 2014
    Reply

    Can Someone Help With HTML/PHP/MySQL? I’m having an issue with inputting data stored in a PHP variable into a HTML form, using the value property in the tag. The problem seems to be that strings are being cut around spaces, where only the first part of the string before the space making it to the form. Strings without spaces appear with a forward slash at the end.

    The idea for the form is that a customer could edit the details store about them on a MySQL database, and then changing the values with an update statement. So it’s really important that the values appear as they are stored in the PHP variables.

    Thanks in advance for any help, my teacher is proving increasingly useless.
    ~J

    (I can post code/screencaps if that would help)
    < ?php //session start// session_start(); //Connect to the server and database// $con=mysqli_connect("127.0.0.1","root","","mia"); //Generate the sql statement for retrieval of customer details// $customerdetails="SELECT Name, BusinessName, Address, Postcode, TelNo, Email FROM customer WHERE CustomerID = " . $_SESSION['CustomerID'] . ""; //execute the 'Customer details retrieve' sql statement// $result= mysqli_query($con, $customerdetails); while ($row = mysqli_fetch_array($result)) { $Name='' . $row['Name'] . ''; $BusinessName=$row['BusinessName']; $Addresss=$row['Address']; $Postcode=$row['Postcode']; $TelNo=$row['TelNo']; $Email=$row['Email']; } //Write the web page// echo "


    <br /> Edit Details<br />



    <br /> Edit Details<br />

    Edit Details

    Please change values below where apropriate


    Name:
    Business Name:
    Address:
    Post Code:
    Telephone No:

    Email Address:

    ” . $Name . “

    ” . $_SESSION[‘CustomerID’] . “


    “;

    ?>
    Apologies if I have misunderstood. I copy/pasted the example you gave me, and the form entry read “< ?php echo $Email;?>“.
    Also, the editor butchered the code, thus i had to split into chunks… messy to say the least.

    http://i.imgur.com/pvfYApy.png
    ^screencap of the issue i’m having

    View Comment
    1. Reply

      You are screwing It up right here, run this example:

      < ?php $Email = "example@google.com"; echo " “;

      ?>

      To solve this, just add two apostrophes, like the following:

      echo “ “;

      It will do the trick.

      See how we can make pathetic mistakes sometimes? Next time, I will say again: make It simpler.

      ——————-

      To make things simpler, you could also use the heredoc syntax:

      http://php.net/manual/en/language.types.string.php

      ——————-
      Take this example and run It:

      < ?php $Email = "example@google.com"; ?>

      Edit your e-mail:
      View Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: