Можете ли вы выполнить два запроса к разным таблицам, чтобы создать флажки и «проверить» их?Php

Кемеровские программисты php общаются здесь
Ответить
Anonymous
 Можете ли вы выполнить два запроса к разным таблицам, чтобы создать флажки и «проверить» их?

Сообщение Anonymous »


I am currently using a table that uses a show columns query to echo all the columns into checkboxes. The below code works for that. I tried to create another query right under the query to search a different table that has the same columns and if the row in this table has a 0 or 1 it will show a "checked" box. The reason I use the "show columns" query is because of always adding more columns for items.

/////EDIT after posting I realized that it will be better just to use the same table since the "Columns" represent all the "checkboxes" when output anyway. But the same problem still exists. I am trying to double up on the queries. Query 1 = Extract all columns and create checkboxes Query 2 = use row that matches $newloc and if checkboxes are in specific columns mark out put columns with "Checked" boxes. I have another query on the same page that populated user information which works fine. This page works as a confirmation page which has all user information as well as certain items they have (the Checkboxes) and then they can edit on this page and submit if needed. I want to be clear on all that is in this page just in case that effects this part. One other thing I need to add is since I am using the same table I need to skip the first 3 columns since that is other data that I dont want as columns.

I tried to use the query below with the one above to get the check box "checked" columns. But failed.

$sql = "SELECT * FROM matmemmatrix WHERE memid1 = '$uid' && memlocid = '$newloc'"; I couldn't get any results from that query to work with the above query.

I tried using this query above by itself to extract all the columns to use as checkboxes and use the row data with a 1 or 0 to mark as checked but failed.

Is it possible to get the columns from this query to use as checkboxes and use the row data to show it checked if 1 or 0? I want to make sure all columns in the table are showing whether or not they are checked.


Источник: https://stackoverflow.com/questions/780 ... -have-them
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Php»