/    Sign up×
Community /Pin to ProfileBookmark

Edit Page not bring values from Database

hi,there

for the past serveral day i have been trying to get an edit page for the project i am working on.And this Project is a a page that allows you to edit information that is stored in a database i have created a add page but i am trying to do now is to get an edit page so it gets data from the database using the get command i have a field in the database called PID I have tried the command $_GET[‘PID] but have no clue on how to get the info from the database.

I have attached my inc file which is in a .txt format

[upl-file uuid=11acbe4d-7545-4287-8d32-1ac88bcae502 size=4kB]editPage.txt[/upl-file]

to post a comment
PHP

19 Comments(s)

Copy linkTweet thisAlerts:
@GarySJul 01.2006 — Try changing this (line 71)

$gQuery="SELECT * FROM pages WHERE PID-$PID";

to

$gQuery="SELECT * FROM pages WHERE PID=$PID";
Copy linkTweet thisAlerts:
@william232authorJul 01.2006 — Still doesnt bring the content from the database into the text boxs in that page so how can i fix that?
Copy linkTweet thisAlerts:
@GarySJul 01.2006 — First thing to do is to make sure the data is being taken from the database. Add this to line after the line "$data=$rs->fetch_assoc();"

[code=php]
print_r($data);
[/code]


... and post back the result.
Copy linkTweet thisAlerts:
@william232authorJul 01.2006 — still comes up with nothing

here is wat i get

http://img305.imageshack.us/img305/5595/editpage9zc.jpg
Copy linkTweet thisAlerts:
@GarySJul 01.2006 — My suggestion was not a fix for the problem: it was an attempt to locate the problem.

If you want me to help you further, please do as I suggested.
Copy linkTweet thisAlerts:
@william232authorJul 01.2006 — I did that what else do i need to do?
Copy linkTweet thisAlerts:
@GarySJul 01.2006 — Sorry - hadn't realised that you'd done it. That being the case, we know that the if($count>0) is not being executed. (If it was, the minimum that would be displayed is "Array()" .)

Put it another way: the query is either failing, or is returning zero results.

Couple of things to do:
[list]
  • [*]Echo the value of "$gQuery" and post it back here.

  • [*]Move the print_r($data) to just before the form. Again, post the result back here.

  • [/list]
    Copy linkTweet thisAlerts:
    @william232authorJul 02.2006 — i have still have echoed the gQuery and still doesnt bring anything back and i have move the the print_r($data) and still nothing
    Copy linkTweet thisAlerts:
    @GarySJul 02.2006 — That's twice you've told me "it brought nothing back" - when we've not yet done anything to fix the problem!

    Diagnosis first, fixing second!

    Let be clear: your saying that:
    [list]
  • [*]echoing $gQuery resulted in nothing being displayed?

  • [*]the print_r also brought nothing to the screen?

  • [/list]

    ... cos the very least you should have seen was an error message!

    As it stands:
    [list]
  • [*]I don't know if your query is sensible (because you have yet to post it)

  • [*]I can't tell if it returning any results (for the same reason)

  • [/list]


    Am I getting the message across??
    Copy linkTweet thisAlerts:
    @william232authorJul 02.2006 — The First Query i have is

    $pQuery="Update pages Set PName=$PName,PTtitle=$PTitle,PDesc=$PDesc,PKey=$Pkey,Pcontent=$Pcontent,PSTATUS=$PSTATUS WHERE PID=$PID";

    The Second one is

    $gQuery="SELECT * FROM PAGES WHERE PID=$PID";

    i Have tried to echo both of them
    Copy linkTweet thisAlerts:
    @NogDogJul 02.2006 — For any columns which are character data (i.e.: are not integers or floats), you need to quote the values being assigned to them:
    [code=php]
    $pQuery="Update pages Set PName='$PName',PTtitle='$PTitle', <etc.>";
    [/code]
    Copy linkTweet thisAlerts:
    @william232authorJul 02.2006 — oh k done anything else do i need to do?
    Copy linkTweet thisAlerts:
    @GarySJul 03.2006 — We've still yet to see the result (on the screen) of your

    print_r($data)

    ... so we still don't know if any results have been retrieved from the database.
    Copy linkTweet thisAlerts:
    @william232authorJul 04.2006 — no results are displaying at all
    Copy linkTweet thisAlerts:
    @GarySJul 05.2006 — Doesn't surprise me.
    Copy linkTweet thisAlerts:
    @william232authorJul 05.2006 — how can this be fixxed?
    Copy linkTweet thisAlerts:
    @GarySJul 05.2006 — As I said in post #10, if you don't give us any useful information, there's no way we can help you.

    [i][b]Please[/b][/i] re-read post 10 and 14 and post the information requested.
    Copy linkTweet thisAlerts:
    @william232authorJul 05.2006 — There is no erorr message coming up and i will be glad to show you wat i have now

    [upl-file uuid=61a6f2ad-3049-4eb8-9b57-9a5f1a231931 size=4kB]editPage.txt[/upl-file]
    Copy linkTweet thisAlerts:
    @GarySJul 05.2006 — Not asking for an error message, nor for you code. Please read 10 and 14 again.
    ×

    Success!

    Help @william232 spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.22,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @AriseFacilitySolutions09,
    tipped: article
    amount: 1000 SATS,

    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,
    )...