1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Undefined index...

Discussion in 'Web Design & Development' started by JiminSA, Jul 10, 2012.

Thread Status:
Not open for further replies.
Advertisement
  1. JiminSA

    JiminSA Thread Starter

    Joined:
    Dec 15, 2011
    Messages:
    2,058
    Ha-ha! I'm also glad!
    Perhaps you might help me with a quick question - I'm setting up the db using the vehicles.dat file and hit a small prob...
    can I use php data variables in the insert statement? Like this...
    PHP:
    mysql_select_db("surfwhee_vehicles"$con);

    foreach (
    $vehicles["vehicles"] as $id => $vehicles)
    {
        
    $count+=1;
        echo 
    "Count: " $count;
        
    mysql_query("INSERT INTO webentry 
        (datetime, fullname, phone, cell, suburb, make, model, year, kms, colour, extras, servhist, accidents, settlement, finhouse, monthsrem, monthsarr, amtrem, price, comments, tprice, rprice, natis, pics4, wcdisc, aprice, status, notes, agent, datetimestamp)
        VALUES 
        (
    $vehicles['datetime'], $vehicles['fame'], $vehicles['phone'], $vehicles['cell'], $vehicles['suburb'], $vehicles['make'], $vehicles['model'], $vehicles['year'], $vehicles['kms'], $vehicles['colour'], $vehicles['extras'], $vehicles['servhist'], $vehicles['accidents'], $vehicles['settlement'], $vehicles['finhouse'], $vehicles['monthsrem'], $vehicles['monthsarr'], $vehicles['amtrem'], $vehicles['price'], $vehicles['comments'], $vehicles['tprice'], $vehicles['rprice'], $vehicles['natis'], $vehicles['pics4'], $vehicles['wcdisc'], $vehicles['aprice'], $vehicles['status'], $vehicles['notes'], 'Jim', date())");
    }

    mysql_close($con);
    And yet another quessy...
    I created the db using the server ControlPanel software (phpMyAdmin) and half expected to pick up the localhost MySql directory in FileZilla, but haven't. Is there any way that I can? (I would like to download it to xampp)
     
  2. allnodcoms

    allnodcoms

    Joined:
    Jun 30, 2007
    Messages:
    613
    Sorry Jim, was watching the cycling... Yes, you can use PHP variables, but you drop the single quotes -$vehicles['datetime'] would become $vehicles[datetime]... No idea why, it's just the way it is.

    You made the DB with phpMyAdmin on your remote server and want to download it to localhost? Your control panel has an export option which lets you save not only the DB data, but also the SQL code necessary to create the whole thing again somewhere else. Just export your DB and import it locally, it'll all be there waiting for you. Did I mention this was easy? ;)

    Danny
     
  3. JiminSA

    JiminSA Thread Starter

    Joined:
    Dec 15, 2011
    Messages:
    2,058
    You did mate! Easy-peasy as Oliver might say - thanks ol' mate 'specially for the quotes thing - I'd a been going in circles otherwise...(y)
     
  4. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1060359