lewashby 56 Junior Poster
// Array for one's place
char arrayOnes[10] = {"", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"}

In the code above I'm having trouble declaring this array. I either get > error: too many initializers for ‘char [10]’

lewashby 56 Junior Poster

Nope

mv: cannot stat `Screenshot': No such file or directory
mv: cannot stat `from': No such file or directory
mv: cannot stat `2013-07-02': No such file or directory
mv: cannot stat `21:14:58.png': No such file or directory

When I do it that way the mv command seems to be handed each world alone of each .png file and is trying to treat each word as a file untu it's self.

lewashby 56 Junior Poster

When I do that I get these errors.

mv: cannot stat `Screenshot': No such file or directory
mv: cannot stat `from': No such file or directory
mv: cannot stat `2013-07-02': No such file or directory
mv: cannot stat `11:05:31.png': No such file or directory
lewashby 56 Junior Poster

Here's what I'v got right now. It moves the Screenshot...png files just fine but when it moves a file it also prints this error to bash as soon as I open a terminal. Any ideas?

mv: cannot stat ls': No such file or directory

#!/bin/bash

# This is a script to keep my $HOME/Pictures directory from keeting clutered up
# with screenshots by moving them into their own directory.

ls ~/Pictures/Screenshot*png > /dev/null 2> /dev/null

if [ ${?} == 0 ] #{
then
    cd ~/Pictures
    for i in ls "Screenshot*png"
        do
                mv ${i} /home/garrett/Pictures/ScreenShots/
        done
fi #}
#END#
lewashby 56 Junior Poster

Deleted!

lewashby 56 Junior Poster

Here's what my code looks like now but I'm getting an erro to do with the fi command.

/home/garrett/bin/mvScreenShots.sh: line 14: syntax error near unexpected token `fi'
/home/garrett/bin/mvScreenShots.sh: line 14: fi

#!/bin/bash

# This is a script to keep my $HOME/Pictures directory from keeting clutered up
# with screenshots by moving them into their own directory.

ls ~/Pictures/Screenshot*png > /dev/null 2> /dev/null

if [ ${?} -eq 0 ]
then
    for i in ls ~/Pictures/
        do
            if [ ${i} == "Screenshot*png" ]
                mv ${i} /home/garrett/Pictures/ScreenShots/
            fi
        done
fi

#mv /home/garrett/Pictures/Screenshot\ from*.png /home/garrett/Pictures/ScreenShots/
#END#
lewashby 56 Junior Poster

In the following script I'm trying to have an automated task to move all the screen shots I have taken with the "Prt Scr" button from ~/Pictures to ~/Pictures/ScreenShots
Any ideas why it's not working. I did it at first with the mv command but was told by my instructor do it with a for loop because of globbing issues.

#!/bin/bash

# This is a script to home keep my $HOME/Pictures directory from keeting clutered up
# with screenshots by moving them into their own directory.

ls ~/Pictures/Screenshots\ from*.png > /dev/null 2> /dev/null
EXITSTATUS=${?}

if [ ${EXITSTATUS} == 0 ]
then
    for ${i} in $( ls ~/Pictures/Screenshot\ from*.png )
        do
            mv ${i} /home/garrett/Pictures/ScreenShots/
        done
fi

#mv /home/garrett/Pictures/Screenshot\ from*.png /home/garrett/Pictures/ScreenShots/
#END#
lewashby 56 Junior Poster

In the following script I'm trying to have an automated task to move all the screen shots I have taken with the "Prt Scr" button from ~/Pictures to ~/Pictures/ScreenShots
Any ideas why it's not working. I did it at first with the mv command but was told by my instructor do it with a for loop because of globbing issues.

#!/bin/bash

# This is a script to home keep my $HOME/Pictures directory from keeting clutered up
# with screenshots by moving them into their own directory.

ls ~/Pictures/Screenshots\ from*.png > /dev/null 2> /dev/null
EXITSTATUS=${?}

if [ ${EXITSTATUS} == 0 ]
then
    for ${i} in ls ~/Pictures/Screenshot\ from*.png
        do
            mv ${i} /home/garrett/Pictures/ScreenShots/
        done
fi

#mv /home/garrett/Pictures/Screenshot\ from*.png /home/garrett/Pictures/ScreenShots/
#END#
lewashby 56 Junior Poster

CimmerianX, It seems that the UUI program only available on Windows.

lewashby 56 Junior Poster

I'M trying to get backtrack Linux to boot from a USB flash drive. The book I'M reading is haivng me to a lot of formating and what not on the flash drive from the CLI and then use rsync to copy the contents of the backtrack disk to the flash drive. I'M having trouble getting things to work. Is there an easier way got get my backtrack .iso file onto the USB stick as a bootable disk? Thanks.

lewashby 56 Junior Poster

I want the content on the page to resize as the browser is resized by the user but it isn't working for me. Am I going about it the wrong way? Thanks guys.

lewashby 56 Junior Poster

In the following css and html document can anyone tell me why my page width css code isn't working?

mystyle.css

#page
{
    width: 25%;
}

Here's the html page.

<html>
<head>
<title>Bail Bonding</title>
</head>

<body>
<link rel="stylesheet" type="text/css" href="mystyles.css" media="screen" />

<form action="bail.php" method="POST">

<div id="page">
<table width="25%">

<tr> <td>First Name:</td> 
     <td align="right"> <input type="text" name="fname"></td></tr>

<tr> <td>Last Name:</td>
     <td align="right"> <input type="text" name="lname"></td></tr>

<tr> <td>Address:</td>
     <td align="right"> <input type="text" name="address"</td></tr>

<tr> <td>City:</td>
     <td align="right"> <input type="text" name="city"</td></tr>

<tr> <td>Zip code:</td>
     <td align="right"> <input name="zip"></td></tr>

<tr> <td>Sate: <select name="sate">

    <option value="NONE"> Select</option>
    <option value="AL"> AL - Alabama</option>
    <option value="AK"> AK - Alaska</option>
    <option value="AZ"> AZ - Arizona</option>
    <option value="AR"> AR - Arkansas</option>
    <option value="CA"> CA - Califonria</option>
    <option value="CO"> CO - Colorado</option>
    <option value="CT"> CT - Connecticut</option>
    <option value="DE"> DE - Delaware</option>
    <option value="FL"> FL - Florida</option>
    <option value="GA"> GA - Georgia</option>
    <option value="HI"> HI - Hawaii</option>
    <option value="ID"> ID - Idaho</option>
    <option value="IL"> IL - Illinois</option>
    <option value="IN"> IN - Indiana</option>
    <option value="IA"> IA - Iowa</option>
    <option value="KS"> KS - Kansas</option>
    <option value="KY"> KY - Kentucky</option>
    <option value="LA"> LA - Louisiana</option>
    <option value="ME"> ME - Maine</option>
    <option value="MD"> MD - Maryland</option>
    <option value="MA"> MA - Massachusetts</option>
    <option value="MI"> MI - Michigan</option>
    <option value="MN"> MN - Minnesota</option>
    <option value="MS"> MS - Mississippi</option>
    <option value="MO"> MO - Missouri</option>
    <option value="MT"> MT - Montana</option>
    <option value="NE"> NE - Nebraska</option>
    <option value="NV"> NV - Nevada</option>
    <option value="NH"> NH - New Hampshire</option>
    <option value="NJ"> NJ - New Jersey</option>
    <option value="NM"> NM …
lewashby 56 Junior Poster

sepp2k, I will look at what you described and see what I can come up with. It takes every neuron I have to attempt working with array+pointers.

tinstaafl, Thanks but I have been told not to use the string class, or classes at all for that matter. I have to do this using C-style strings.

lewashby 56 Junior Poster

The only thing that is in functions.h is the prototype for the get_gropus function "int get_groups( int length );".

I input 1 I get the following:

--> The inputNumber variable is: 1
--> Segmentation fault (core dumped)

I input 12 I get the following:

--> The inputNumber variable is: 12
--> 022 (should be 012)

I input 123 I get the following:

--> Number is evenly divisible by 3 (continues as it should)

lewashby 56 Junior Poster

In the following program I'M trying to take a number no more than 12 digits long and make it a factor of 3.

If the input is 1, the program would turn the number into 001.
If the input is 12, the program would turn the number into 012.
If the input is 123, the program would simple continue.

The magic should be happening after the second while loop. Can anyone tell me what I'M doing wrong. When I input one digit I get the error "Segmentation fault (core dumped)", when I input two digits it seems to be replacing the first digit with a copy of the second, the only thing it does right is insert the '0' into position[0]. Code is below, thanks.

#include <iostream>
#include <stdlib.h>
#include <string.h>
#include "functions.h"

int main(int argc, char *argv[])
{
    if(strlen(argv[1]) % 3 != 0 || strlen(argv[1]) < 3)
    {
        char inputNumber[13];
        char *numberProcessor = inputNumber;

        // insert the char elements from argv[1] into the elements of inputNumber
        char *counter = argv[1];
        while(*counter != '\0')
        {
            *numberProcessor = *counter;

            counter++;
            numberProcessor++;
        }
std::cout << "The inputNumber variable is :" << inputNumber << std::endl;

        // move each elemtn to the right one space and insert a '0' as the first element of inputNumber until the condition fails.
        int backwardCounter = strlen(inputNumber);
        while(strlen(inputNumber) % 3 != 0 || strlen(inputNumber) < 3)
        {
            inputNumber[backwardCounter + 1] = inputNumber[backwardCounter];
            backwardCounter--;

            if(backwardCounter == 0)
            {
                inputNumber[0] = '0';
            }
        }

        std::cout << inputNumber …
lewashby 56 Junior Poster

I need to move my favorites from my firefox on my Windows partiton to the firefox sitting on my Linux partition. What do I copy/cut the from on the Windows partition and where to I past them for firefox on the Linux partition? Thanks.

lewashby 56 Junior Poster

I'M trying to make the following web page fluid, or liquid. I want the page and form to resize as the browser is resized. Any idea on how I can accomplish this? Thanks.

<html>
<head>
<title>Test</title>
</head>

<body>
<link rel="stylesheet" type="text/css" href="mystyles.css" media="screen" />

<form action="bail.php" method="POST">

<div id="page">
<table width="25%">

<tr> <td>First Name:</td> 
     <td align="right"> <input type="text" name="fname"></td></tr>

<tr> <td>Last Name:</td>
     <td align="right"> <input type="text" name="lname"></td></tr>

<tr> <td>Address:</td>
     <td align="right"> <input type="text" name="address"</td></tr>

<tr> <td>City:</td>
     <td align="right"> <input type="text" name="city"</td></tr>

<tr> <td>Zip code:</td>
     <td align="right"> <input name="zip"></td></tr>

<tr> <td>Sate: <select name="sate">

    <option value="NONE"> Select</option>
    <option value="AL"> AL - Alabama</option>
    <option value="AK"> AK - Alaska</option>
    <option value="AZ"> AZ - Arizona</option>
    <option value="AR"> AR - Arkansas</option>
    <option value="CA"> CA - Califonria</option>
    <option value="CO"> CO - Colorado</option>
    <option value="CT"> CT - Connecticut</option>
    <option value="DE"> DE - Delaware</option>
    <option value="FL"> FL - Florida</option>
    <option value="GA"> GA - Georgia</option>
    <option value="HI"> HI - Hawaii</option>
    <option value="ID"> ID - Idaho</option>
    <option value="IL"> IL - Illinois</option>
    <option value="IN"> IN - Indiana</option>
    <option value="IA"> IA - Iowa</option>
    <option value="KS"> KS - Kansas</option>
    <option value="KY"> KY - Kentucky</option>
    <option value="LA"> LA - Louisiana</option>
    <option value="ME"> ME - Maine</option>
    <option value="MD"> MD - Maryland</option>
    <option value="MA"> MA - Massachusetts</option>
    <option value="MI"> MI - Michigan</option>
    <option value="MN"> MN - Minnesota</option>
    <option value="MS"> MS - Mississippi</option>
    <option value="MO"> MO - Missouri</option>
    <option value="MT"> MT - Montana</option>
    <option value="NE"> NE - Nebraska</option>
    <option value="NV"> NV - Nevada</option>
    <option value="NH"> NH - New Hampshire</option>
    <option value="NJ"> NJ - New Jersey</option>
    <option value="NM"> …
lewashby 56 Junior Poster

Does anyone know where you can buy 1080p movies and tv shows online with no drm? I hate having to use specifies software or a specific OS just to play video file. I prefer to place things on my own home server and use them when and how I want.

lewashby 56 Junior Poster

Note that I'M using Mint Linux with Cinnamon. I just got a new 250 Gig SSD and I'd like to have it mounted at /home/garrett. First of all, what's the best way to do this? Should I simply add a mount command to my .profile file? Secondly, I'M assuming that I'll need to move everything that's currently under /home/garrett to that drive before having it mounted, I figured things could get a little screwy if I'M logged in as garrett when this is preformed. So should I fist swith to runlevel 1 (single user no GUI) and log in as root as not to frak up anything when I move my files? Also, what command whould I use to move it all, I don't know if a simple mv would get it or not. I need to make sure I get everything including all the files that begin with '.'. Thanks.

lewashby 56 Junior Poster

I recently had problems with Cinnamon DE and I had to temporarily download and install gnome3, which then altered the login screen a little. After I fixed my cinnamon problem and removed gnome3 I'M still stuck with this other login screen that I don't like as much as the original cinnamon login screen. Any idea on how I might get the old one back?

One more thing, I'd like to add my Windows 7 that's on another HD it grub. At this point I'M not asking how to do that right now I just need to know how to find out what HD and partitoin the grub is on the is booting my system now. I have a feeling that it's not the grub that's on my Mint Linux system that I normally use.

lewashby 56 Junior Poster

I got it with sudo mkfs -t ext4 /dev/sdc

Thanks, I wouldn't have noticed that it was sdc with the dmesg command you gave me, didn't know that one. Like you it appeared to me that it was sg6.

lewashby 56 Junior Poster

Here's what I got:

garrett@mint-desktop ~ $ dmesg | tail
[11392.002016] sd 6:0:0:0: [sdc] Write Protect is off
[11392.002020] sd 6:0:0:0: [sdc] Mode Sense: 28 00 00 00
[11392.002740] sd 6:0:0:0: [sdc] No Caching mode page present
[11392.002744] sd 6:0:0:0: [sdc] Assuming drive cache: write through
[11392.005363] sd 6:0:0:0: [sdc] No Caching mode page present
[11392.005368] sd 6:0:0:0: [sdc] Assuming drive cache: write through
[11392.056637]  sdc: unknown partition table
[11392.061737] sd 6:0:0:0: [sdc] No Caching mode page present
[11392.061742] sd 6:0:0:0: [sdc] Assuming drive cache: write through
[11392.061745] sd 6:0:0:0: [sdc] Attached SCSI disk
lewashby 56 Junior Poster

In those examples the drive was mounting just fine and mounting where it should, I'M not that luck, take a look.

Here's what I get with the HD plugged in:

garrett@ubuntu:~$ ls -l /dev
total 0
crw------T  1 root    root     10, 235 Mar 29 15:44 autofs
drwxr-xr-x  2 root    root         740 Mar 29 16:30 block
drwxr-xr-x  2 root    root         160 Mar 29 16:30 bsg
crw------T  1 root    root     10, 234 Mar 29 15:44 btrfs-control
drwxr-xr-x  3 root    root          60 Mar 29 15:43 bus
lrwxrwxrwx  1 root    root           3 Mar 29 15:44 cdrom -> sr0
lrwxrwxrwx  1 root    root           3 Mar 29 15:44 cdrw -> sr0
drwxr-xr-x  2 root    root        3880 Mar 29 16:30 char
crw-------  1 root    root      5,   1 Mar 29 15:44 console
lrwxrwxrwx  1 root    root          11 Mar 29 15:44 core -> /proc/kcore
drwxr-xr-x  2 root    root          60 Mar 29 15:44 cpu
crw-------  1 root    root     10,  60 Mar 29 15:44 cpu_dma_latency
drwxr-xr-x  5 root    root         100 Mar 29 15:43 disk
drwxr-xr-x  2 root    root          80 Mar 29 15:44 dri
lrwxrwxrwx  1 root    root           3 Mar 29 15:44 dvd -> sr0
lrwxrwxrwx  1 root    root           3 Mar 29 15:44 dvdrw -> sr0
crw-------  1 root    root     10,  61 Mar 29 15:44 ecryptfs
crw-rw----  1 root    video    29,   0 Mar 29 15:44 fb0
lrwxrwxrwx  1 root    root          13 Mar 29 15:44 fd -> /proc/self/fd
crw-rw-rw-  1 root    root      1,   7 Mar 29 15:44 full
crw-rw-rwT  1 root    fuse     10, 229 Mar 29 15:44 fuse
crw-------  1 root    root    251, …
lewashby 56 Junior Poster

Just purchased a new Samsung 250 Gig SSD, extern & internal. When I pluged it into my Mint Linux desktop via USB it never showed up or auto mounted. When I tried to run the command 'sudo mount /dev/sdc /mnt' it gave me this error, 'mount: you must specify the filesystem type'. I have yet to format and I have no idea what it is out of the box. What can I do here? Thanks.

lewashby 56 Junior Poster

Thanks.

lewashby 56 Junior Poster

I just went in to edit /boot/grub/grub.cfg and the first thing I seen in the file was this:

#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

How am I to make changes if the first thing I see is a comment telling me not to make changes or edit this file.

lewashby 56 Junior Poster

I'M using the program ByteCopy by PavTube to rip my DVD and BDs into .mkv files. The program can rip with lossless quality. The problem I'M having is that it's ripping each disk of my DVD and BD tv shows as one giant file rather than ripping each episode individually. What's a good program I can use to split my mkv files up into multiple files? And it needs to be able to save in full 1080p, I would hate to edit my files in a program that can't handle that res and have it downgrade my videos. Thanks.

lewashby 56 Junior Poster

I want the form to resize as the browser resizes. I want to make this page liquid, or fluid.

lewashby 56 Junior Poster

How can I make the following web page liquid? I want the fomr to resize with the browser.

<html>
<head>
<title>Bail Bonding</title>
</head>

<body>
<form action="bail.php" method="POST">

<table width="25%">

<tr> <td>First Name:</td> 
     <td align="right"> <input type="text" name="fname"></td></tr>

<tr> <td>Last Name:</td>
     <td align="right"> <input type="text" name="lname"></td></tr>

<tr> <td>Address:</td>
     <td align="right"> <input type="text" name="address"</td></tr>

<tr> <td>City:</td>
     <td align="right"> <input type="text" name="city"</td></tr>

<tr> <td>Zip code:</td>
     <td align="right"> <input name="zip"></td></tr>

<tr> <td>Sate: <select name="sate">

    <option value="NONE"> Select</option>
    <option value="AL"> AL - Alabama</option>
    <option value="AK"> AK - Alaska</option>
    <option value="AZ"> AZ - Arizona</option>
    <option value="AR"> AR - Arkansas</option>
    <option value="CA"> CA - Califonria</option>
    <option value="CO"> CO - Colorado</option>
    <option value="CT"> CT - Connecticut</option>
    <option value="DE"> DE - Delaware</option>
    <option value="FL"> FL - Florida</option>
    <option value="GA"> GA - Georgia</option>
    <option value="HI"> HI - Hawaii</option>
    <option value="ID"> ID - Idaho</option>
    <option value="IL"> IL - Illinois</option>
    <option value="IN"> IN - Indiana</option>
    <option value="IA"> IA - Iowa</option>
    <option value="KS"> KS - Kansas</option>
    <option value="KY"> KY - Kentucky</option>
    <option value="LA"> LA - Louisiana</option>
    <option value="ME"> ME - Maine</option>
    <option value="MD"> MD - Maryland</option>
    <option value="MA"> MA - Massachusetts</option>
    <option value="MI"> MI - Michigan</option>
    <option value="MN"> MN - Minnesota</option>
    <option value="MS"> MS - Mississippi</option>
    <option value="MO"> MO - Missouri</option>
    <option value="MT"> MT - Montana</option>
    <option value="NE"> NE - Nebraska</option>
    <option value="NV"> NV - Nevada</option>
    <option value="NH"> NH - New Hampshire</option>
    <option value="NJ"> NJ - New Jersey</option>
    <option value="NM"> NM - New Mexico</option>
    <option value="NY"> NY - New York</option>
    <option value="NC"> NC - North Carolina</option>
    <option value="ND"> ND - North Dakota</option>
    <option …
lewashby 56 Junior Poster

I'M trying to output a message if the PHP query on the MySQL database come back empty. But when I uncomment this line //echo "No result found for entry"; not only does it fail to output this message when there is no match but it also fails to load the page at all. If this line is un commented I get nothing but a solid white page. PHP code is below. Any ideas?

<?php

// get variable from html form
$fName = $_POST['fname'];
$lName = $_POST['lname'];
$address = $_POST['address'];
$city = $_POST['city'];
$zip = $_POST['zip'];
$state = $_POST['state'];

// Create connection
$con=mysqli_connect("localhost", "garrett", "xyz", "bailbond");

// Check connection
if(mysqli_connect_errno($con))
  {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }

$result = mysqli_query($con, "SELECT * FROM people WHERE fname='$fName' or lname='$lName' or address='$address'");

if(!$result)
{
    //echo "MySQL Error: " . mysqli_error($con) . "\n";
    //echo "No result found for entry";
}

else
{
    while($row = mysqli_fetch_array($result))
    {
        echo $row['fname'] . " " . $row['lname'] . " " . $row['address'] . " " . $row['city'] . " " . $row['state'] . " " . $row['zip'];
        echo "<br /> <br />";
    }
}

?>
lewashby 56 Junior Poster

Yes you are right. I am dumb. Thanks.

lewashby 56 Junior Poster

Thanks.

lewashby 56 Junior Poster

ERROR 1054 (42S22): Unknown column 'Firstname' in 'field list'

I'M gettin the above error when I enter:

mysql> insert into people (fname, lname)
    -> VALUES (Firstname, Lastname);

Here's the table:

mysql> desc people;
+-------------+-------------+------+-----+---------+-------+
| Field       | Type        | Null | Key | Default | Extra |
+-------------+-------------+------+-----+---------+-------+
| fname       | varchar(20) | YES  |     | NULL    |       |
| lname       | varchar(20) | YES  |     | NULL    |       |
| phonenumber | varchar(10) | YES  |     | NULL    |       |
| city        | varchar(20) | YES  |     | NULL    |       |
| state       | varchar(20) | YES  |     | NULL    |       |
| address     | varchar(30) | YES  |     | NULL    |       |
| zip         | varchar(5)  | YES  |     | NULL    |       |
+-------------+-------------+------+-----+---------+-------+

Any ideas?

lewashby 56 Junior Poster

What's gvfs and why can't root access it?

Emphasized Text Heremint-desktop ~ # du -sh /home/garrett
du: cannot access `/home/garrett/.gvfs': Permission denied
73G /home/garrett
lewashby 56 Junior Poster

The problem was here:

echo $fName." ";
echo $lName."</p>";
echo $phoneNumber."</p>";
echo $address."</p>";
echo $zip."</p>";
echo $state."</p>";

All I had to do was change all the "</p>"s to "<br />", then the MySQL query started working just fine.

lewashby 56 Junior Poster

I've been having a problem with my php, apache, mysql. I can't find the problem so I'M gong to uninstall all of them and re-install them using tasksel. But when I type sudo apt-get remove mysql, it returns the following:

garrett@mint-desktop ~ $ sudo apt-get remove mysql
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package mysql

Any ideas?

lewashby 56 Junior Poster

mysql -u lrngsql -p

Above is the command I typed to log into MySQL. Entered my password 'xyz' then I typed use bank;

Whichin MySQL I typed 'select fname from person' and itreturned two names, William & Susan, so the database is there and it is populated. Could there be something else I need to do in order to link apache to MySQL, or PHP to MySQL?

lewashby 56 Junior Poster

I just made all the changes and there is still nothing showing up from mysql. The PHP above is still dispalying the html form variables just fine. Below is my html form so you can see what's activating the script. Also, is there somthing else I might need to do in order to link PHP and MySQL or Apache and MySQL?

<html>
<head>
<title>Test</title>
</head>

<body>
<form action="bail.php" method="POST">
<form>
<table width="25%">

<tr> <td>First Name:</td> 
     <td align="right"> <input type="text" name="fName"></td></tr>

<tr> <td>Last Name:</td>
     <td align="right"> <input type="text" name="lName"></td></tr>

<tr> <td>Phone Number:</td>
     <td align="right"> <input type="text" name="phoneNumber"</td></tr>

<tr> <td>Address:</td>
     <td align="right"> <input type="text" name="address"</td></tr>

<tr> <td>Zip code:</td>
     <td align="right"> <input name="zip"></td></tr>

<tr> <td>Sate: <select name="sate">

    <option value="NONE"> Select</option>
    <option value="AL"> AL - Alabama</option>
    <option value="AK"> AK - Alaska</option>
    <option value="AZ"> AZ - Arizona</option>
    <option value="AR"> AR - Arkansas</option>
    <option value="CA"> CA - Califonria</option>
    <option value="CO"> CO - Colorado</option>
    <option value="CT"> CT - Connecticut</option>
    <option value="DE"> DE - Delaware</option>
    <option value="FL"> FL - Florida</option>
    <option value="GA"> GA - Georgia</option>
    <option value="HI"> HI - Hawaii</option>
    <option value="ID"> ID - Idaho</option>
    <option value="IL"> IL - Illinois</option>
    <option value="IN"> IN - Indiana</option>
    <option value="IA"> IA - Iowa</option>
    <option value="KS"> KS - Kansas</option>
    <option value="KY"> KY - Kentucky</option>
    <option value="LA"> LA - Louisiana</option>
    <option value="ME"> ME - Maine</option>
    <option value="MD"> MD - Maryland</option>
    <option value="MA"> MA - Massachusetts</option>
    <option value="MI"> MI - Michigan</option>
    <option value="MN"> MN - Minnesota</option>
    <option value="MS"> MS - Mississippi</option>
    <option value="MO"> MO - Missouri</option>
    <option value="MT"> MT - Montana</option>
    <option value="NE"> NE …
lewashby 56 Junior Poster

There was no error on the page to start with. Everything that I enter into the html form is displaying on the PHP page just fine. But nothing is happening with the MySQL partion of the PHP script which is below the PHP code that displays the data entered form the form.

Pixelsoul, I add the tree lines but it didn't change anything, the page is still only displaying data fro the form and nothing from my MySQL database.

IIM or LLM, the or di function is causing the page to be soldd white displaying nothing at all, not even the data from the form that's been displaying just fine.

lewashby 56 Junior Poster

Note that this is on a Linux machine.
I'M just starting to learn PHP and MySQL. I wrote the following php program that executes from an html form. Note that at this point the date from the html form is not being used to query the MySQL database. At this point I'M simply using PHP to display the data entered into the html form to validate that the PHP script is getting the variables from the form, that part is working fine. The second part of the PHP script I'M trying to display a few rows from a simple MySQL database that I've just created. I don't know if my code is bade or if there is something else I need to do in order to link PHP and or Apache to MySQL. Any ideas?

<?php

// get variable from html form
$fName = $_POST['fName'];
$lName = $_POST['lName'];
$phoneNumber = $_POST['phoneNumber'];
$address = $_POST['address'];
$zip = $_POST['zip'];
$state = $_POST['state'];

echo $fName." ";
echo $lName."</p>";
echo $phoneNumber."</p>";
echo $address."</p>";
echo $zip."</p>";
echo $state."</p>";

// Create connection
$con=mysqli_connect("localhost","lrngsql","xyz","bank");

// Check connection
if (mysqli_connect_errno($con))
  {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }

$result = mysqli_query($con, "SELECT fname, lname FROM person");

while($row = mysqli_fetch_array($result))
{
    echo $row['fname'] . " " . $row['lname'];
    echo "<br />";
}


?>
lewashby 56 Junior Poster

It work fine when I point the url streight to the php file. localhost/bail.php -> outputs Hello World

When the same file is called from an html form the browser downloads bail.php to my /home/downloads directory.

lewashby 56 Junior Poster

lamp

lewashby 56 Junior Poster

It's working just fine.

lewashby 56 Junior Poster

Here's the html code fomr the book "PHP and MySQL Web Development"

<html>
<body>
<form action="processorder.php" method="post">
<table border="0">
<tr bgcolor="#cccccc">
  <td width="150">Item</td>
  <td width="15">Quantity</td>
</tr>
<tr>
  <td>Tires</td>
  <td align="center"><input type="text" name="tireqty" size="3"
     maxlength="3"></td>
</tr>
<tr>
  <td>Oil</td>
  <td align="center"><input type="text" name="oilqty" size="3" maxlength="3"></td>
</tr>
<tr>
  <td>Spark Plugs</td>
  <td align="center"><input type="text" name="sparkqty" size="3"
     maxlength="3"></td>
</tr>
<tr>
  <td>How did you find Bob's?</td>
  <td><select name="find">
        <option value = "a">I'm a regular customer</option>
        <option value = "b">TV advertising</option>
        <option value = "c">Phone directory</option>
        <option value = "d">Word of mouth</option>
      </select>
  </td>
</tr>
<tr>
  <td colspan="2" align="center"><input type="submit" value="Submit Order"></td>
</tr>
</table>
</form>
</body>
</html>
lewashby 56 Junior Poster

When I click a link a simple HTML web form linked to a php file, the browser is downloading the PHP file rather than executuing it in the browser. Any dieas?

lewashby 56 Junior Poster

The following code block is producing and endless loop and I can't figure out why. Note that charv is just he second command line argument in the main function.

    int testNumber = 1;
    while(argv != '\0')
    {
        std::cout << testNumber;
        argv++;
        testNumber++;
    }

I wrote this piece of code just as a test to see if the loop could be controled using the '\0' element of the char array from the command line argument.

lewashby 56 Junior Poster

I'M an idiot. Sorry for posting this and wasting your time.

lewashby 56 Junior Poster

In the following html/php page why is my "select" tag not showing all the options?

<html>
<head>
<title>Learning PHP & HTML</title>
</head>

<body>
<form action="somefile.php" method="post">
<form>
<table width="25%">

<tr> <td>First Name:</td> 
     <td align="right"> <input type="text" name="fName"></td></tr>

<tr> <td>Last Name:</td>
     <td align="right"> <input type="text" name="lName"></td></tr>

<tr> <td>Phone Number:</td>
     <td align="right"> <input type="text" name="phoneNumber"</td></tr>

<tr> <td>Address:</td>
     <td align="right"> <input type="text" name="address"</td></tr>

<tr> <td>Zip code:</td>
     <td align="right"> <input name="zip"></td></tr>

<tr> <td>Sate: <select name="sate">

    <option value="NONE"> Select</option>
    <optoin value="AL"> AL - Alabama</option>
    <optoin value="AK"> AK - Alaska</option>
    <optoin value="AZ"> AZ - Arizona</option>
    <optoin value="AR"> AR - Arkansas</option>
    <optoin value="CA"> CA - Califonria</option>
    <optoin value="CO"> CO - Colorado</option>
    <optoin value="CT"> CT - Connecticut</option>
    <optoin value="DE"> DE - Delaware</option>
    <optoin value="FL"> FL - Florida</option>
    <optoin value="GA"> GA - Georgia</option>
    <optoin value="HI"> HI - Hawaii</option>
    <optoin value="ID"> ID - Idaho</option>
    <optoin value="IL"> IL - Illinois</option>
    <optoin value="IN"> IN - Indiana</option>
    <optoin value="IA"> IA - Iowa</option>
    <optoin value="KS"> KS - Kansas</option>
    <optoin value="KY"> KY - Kentucky</option>
    <optoin value="LA"> LA - Louisiana</option>
    <optoin value="ME"> ME - Maine</option>
    <optoin value="MD"> MD - Maryland</option>
    <optoin value="MA"> MA - Massachusetts</option>
    <optoin value="MI"> MI - Michigan</option>
    <optoin value="MN"> MN - Minnesota</option>
    <optoin value="MS"> MS - Mississippi</option>
    <optoin value="MO"> MO - Missouri</option>
    <optoin value="MT"> MT - Montana</option>
    </select>
</table>
</body>
</html>
lewashby 56 Junior Poster

I'M trying to learn PHP (note that I am using Linux) and I'M having trouble keeping the /var/www directory clean. Since that is the directory that apache will host the files from, how can you keep that directory organized with and for multiple web projects or practive assignments from differenct PHP books? Normally I would just have a projects foler under my user home directory but in this case I would lose PHP functionality.

lewashby 56 Junior Poster

No, it's just a computer with a few LFS systems on it. I built two LFS systems, resized a partition and then installed ubuntu server.