php - cant get data from database with mysqli -


i can not figure out why code not working. im trying create temp table , pull data filter data out. cant seem echo data echos column name. here code:

if (!$conn) {     echo "<a href='getschedule.php'><button>go back</button></a>";     die("connection failed: " . mysqli_connect_error());  }else{     echo "connected successfully<br><br>"; } $seasontemp = "create temporary table seasontemp ( id int not null, firstname varchar(255), lastname varchar(255), number varchar(255), address varchar(255), plan_start date not null, plan_comp int(11), plan_skip int(11), trim_start date, trim_comp int(11), trim_skip int(11), spray_start date, spray_comp int(11), primary key(id) )";  mysqli_query($conn, $seasontemp) or die ("sql error : ".mysqli_error($conn));  $insertseason = "insert seasontemp     (id, plan_start, plan_comp, plan_skip, trim_start, trim_comp, spray_start, spray_comp) select id, plan_start, plan_comp, plan_skip, trim_start, trim_comp, spray_start, spray_comp services plan='17'";  mysqli_query($conn, $insertseason) or die ("sql error : ".mysqli_error($conn));  $seasonids = "select 'id', 'plan_start' seasontemp"; $r1 = mysqli_query($conn, $seasonids ) or die ("sql error : ".mysqli_error($conn)); if(mysqli_num_rows($r1) > 0){ $start = mysqli_fetch_assoc($r1); $start_date = $start['plan_start']; echo $start_date;  }  mysqli_close($conn); 

"select 'id', 'plan_start' seasontemp"; 

replace with:

"select `id`, `plan_start` seasontemp"; // wrong quotes added here. 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -