On Thu, 01 Feb 2018 00:04:16 -0500, Call Me Tom wrote:
> The logged user has all privileges on the database.
> The $numin echo prints 2555 which is the number of rows in the table.
> The table test is unchanged after running the file.
> Here's the code.
Useful information here would include "what did you expect to happen",
"what actually did happen" and "what errors were put in the logging".
>
><?php
>
> require_once('./includes/mysql_connect.php');
>
> $query = "SELECT report_id,fsacars_rep_url
> FROM test";
>
> $result=$dbh->query($query);
> $numin=$result->rowCount();
> echo "$numin";
> while($url_orig=$result->FETCH(PDO::FETCH_NUM)) {
> $report_id = $url_orig[0];
> $url_trim = substr($url_orig[1],34);
> $url_new = '
http://localhost/CAA' . $url_trim;
>
> $sql="UPDATE test
> SET fsacars_rep_url = $url_new
> WHERE report_id = $report_id";
> $dbh->exec($sql);
> }
>
> What am I missing?
A bunch of stuff probably unrelated to your question for one thing.
https://xkcd.com/327/ is a start. Learn to use paremeterized prepare and
execute to help prevent that.
I think you may want some quotes around what you're setting columns to.
--
32. I will not fly into a rage and kill a messenger who brings me bad
news just to illustrate how evil I really am. Good messengers are
hard to come by.
--Peter Anspach's list of things to do as an Evil Overlord