How JustAnswer Works:
  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.
Ask The-PC-Guy Your Own Question
The-PC-Guy
The-PC-Guy, Software Engineer
Category: Programming
Satisfied Customers: 1947
Experience:  Extensive Knowledge in PHP, MYSQL, CSS & Javascript
62934938
Type Your Programming Question Here...
The-PC-Guy is online now
A new question is answered every 9 seconds

I have a file I used to backup a database. I have a new

Customer Question

I have a file I used to backup a database. I have a new database PHP 5.5 so I have to convert the file to use mysqli instead of MySQL. This new file is not working and I am not sure what is wrong. I am getting errors. Need help fixing the file.
https://www.mediafire.com/?b21szssa716igba
Submitted: 1 year ago.
Category: Programming
Expert:  The-PC-Guy replied 1 year ago.

i would like to try and help, can you tell me specifically what errors you are getting?

Customer: replied 1 year ago.

Warning: mysqli_query() expects parameter 1 to be mysqli, null given on line 43

Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, null given on line 44

Warning: Cannot modify header information - headers already sent by (output started at:43) on line 87

Expert:  The-PC-Guy replied 1 year ago.

looking at the code it is this line

$row2 = mysqli_fetch_row(mysqli_query($con,'SHOW CREATE TABLE '.$table));

it should be

$row2 = mysqli_fetch_row(mysqli_query($link,'SHOW CREATE TABLE '.$table));

also this row

$result = mysqli_query($con,'SELECT * FROM '.$table);

same thing, $con needs to be $link

as far as the last error correcting the other 2 may fix that as well.

le me know the outcome

Customer: replied 1 year ago.

Now I am getting:

Warning: mysqli_num_fields() expects parameter 1 to be mysqli_result, boolean given in php on line 58

Warning: mysqli_fetch_row() expects parameter 1 to be mysqli_result, boolean given in php on line 61

Warning: Cannot modify header information - headers already sent by (output started at:58) on line 87

Expert:  The-PC-Guy replied 1 year ago.

can you send me a zip file containing the php code as well as any of the requires files if they are needed

along with a .sql export of the db?

Expert:  The-PC-Guy replied 1 year ago.

i am familiar with these errors, but I do need to have something on my computer from which I can work with

Customer: replied 1 year ago.

There are no additional php files needed. This link I provided is the only file that is being used to backup. The require at the top of the file is just verifying that the person is logged in but for the purpose of testing you can comment that line out. https://www.mediafire.com/?b21szssa716igba

I can't send the actual database but here are two test database. On has one table with data, the other has multiple tables but the tables are blank. let me know if this helps.

https://www.mediafire.com/?hm548to409c1jrk

https://www.mediafire.com/?h33o3pue2fdg0fo

Expert:  The-PC-Guy replied 1 year ago.

http://www.ge.tt/2bm7P3Z2

this should now be error free.

note the following:

1. since you are outputting file headers to the browser no html will be displayed, that includes text. This is normal behavior.

2. I set up output buffering in the script so ideally what you could do is assign the output text to a session variable or cookie, for displaying later. to the user, then add a redirect header, to send the user to another script that would output the file after the text was displayed in the previous script.

---------------------------------------------------------------------------------------------------------------

let me know if you have any questions, problems, or concerns

PLEASE DON'T FORGET TO RATE SO I AM PAID FOR MY TIME

IT WILL NOT COST ANYTHING ADDITIONAL BEYOND THE VALUE OF YOUR QUESTION

TO RATE, CLICK THE STARS AT THE TOP OF YOUR SCREEN

Do not rate negatively, instead continue the conversation with me so I can address any of your concerns

---------------------------------------------------------------------------------------------------------------

if you have any questions in the future you can visit my profile

http://www.justanswer.com/computer/expert-1expert-2rulethemall/

and ask a question right in my box,

also you can put "PC Guy only" in your question title if you want to get to me.

Customer: replied 1 year ago.

Everytime I try to download the file I am getting a warning that this file is unsafe to download and it is being blocked. What is the name of the file? Can you try uploading it again?

Expert:  The-PC-Guy replied 1 year ago.

think it was just a php file

Customer: replied 1 year ago.

I don't understand why you are giving me web pages. I just want my backup file to work.

https://www.mediafire.com/?b21szssa716igba

Expert:  The-PC-Guy replied 1 year ago.

i modified your php code to work, so the file that I sent you is meant to replace your original.

Customer: replied 1 year ago.

I think you are sending me someone else file. When I download the zip file I am getting website pages for Winter in New York City. My php code has nothing to do with a website pages. I just trying to backup tables in a database using mysqli functions.

Expert:  The-PC-Guy replied 1 year ago.

ok, let me check the link and try again

Expert:  The-PC-Guy replied 1 year ago.

here I double checked the links, I posted the correct version of your file here, but for some reason it was not showing up. I did this several times now, I will try once more, hopefully this is your file.

Sorry for any confusion. This was beyond my control

Related Programming Questions