J
jasmine381

  • Feb 21, 2020
  • Joined Jan 14, 2020
  • NogDog Query failed: Select * from verb_translation where fkverbid = A order by eng_translation Unknown column 'C' in 'where clause'

    /T1/ pkverbid , inspanish , start_with ,,, verbs
    /T2/ pktranslationid , fkverbid , eng_translation --- verb_translation

    • i have dependend dropdown A to Z alphabet on ist dropdown when click A on second dd all relvent data load on the dropdown

      • (Replaced back-ticks with [code]...[/code] tags ~ MOD)

        I have depended dropdown but this error occur

        <select id="alphaid" name="alphaid" onchange="getalpha(this.value)">
        <option>Select Alphabit</option>
        <?php 
        mysqli_query($conn, "Select * from verbs");
        $alphabits	=	range('A', 'Z');
        foreach($alphabits as $alphabit)
        {
        ?>
        <option value="<?php echo $alphabit; ?>"><?php echo $alphabit; ?> </option>
        <?php } ?> </select> </div></div>
        			    <select class="form-control" name="verbid" id="verbid" onChange="getverb(this.value)">
        							<option>------- Select Verb --------</option>
        								</select>
        ===============================
        <script>
         $(document).ready(function(){
         });
         function getalpha(alphaid)
         {
         $.post("get_verb.php", { alphaid:alphaid }, function(data){
         $("#verbid").html(data);
         });
         }
         
         function getverb(verbid)
         {
         $.post("get_verb.php", { verbid:verbid }, function(data){
         });
         }
         
         </script>
         =========================
         Get_verb.php
        
        if (isset($_POST['alphaid'])){
        $alphaid = $_POST['alphaid'];
        $query = mysqli_query($conn, "Select * from verb_translation where start_with = ".$alphaid." order by eng_translation");
        	if(mysqli_num_rows($query) > 0) 
        	{
        		echo '<option value="">------- Select verbs -------</option>';
        		while($row = mysqli_fetch_assoc($query))
        		{
        			echo '<option value="'.$row->fkverbid.'">'.$row->eng_translation.'</option>';	
        		}
        	} else {
        		echo '<option value="">No Record</option>';
        	}
        
        } 
        • I want to show selected check-boxes on my edit page here my code this code show all check boxes selected but i need to show only specific selected boxes only ?

          • `$id = $_GET['pkcategoryid'];
            if($id != "")
            {
            $updatetenses = mysqli_query($conn, "SELECT * FROM tensecategory WHERE pkcategoryid = '$id'");
            $updatetense = mysqli_fetch_assoc($updatetenses);
            $id = $updatetense['pkcategoryid'];
            $cat_name = $updatetense['cat_name'];
            $tenid = $updatetense['tenid'];

            }

            ?>

            <div id="content">
            <div id="content-header">
            <div id="breadcrumb"> <a href="index.php" title="Go to Home" class="tip-bottom"><i class="icon-home"></i> Home</a>
            <a href="" class="tip-bottom">Tenses</a> <a href="addtoblacklist.php" class="current">Manage Tense Category</a> </div>
            </div>
            <div class="container-fluid">
            <div class="row-fluid">
            <div class="span12">
            <div class="widget-box">
            <div class="widget-title"> <span class="icon"> <i class="icon-align-justify"></i> </span>
            <h5>Manage Tense Categories</h5>
            </div>
            <div class="widget-content nopadding">
            <form name="addtoblacklistform" id="addtoblacklistform" action="cataction.php" method="post" class="form-horizontal">
            <div class="control-group">
            <label class="control-label">Category Name :</label>
            <div class="controls">
            <input type="text" class="span6" name="cat_name" id="cat_name" value="<?php echo $cat_name; ?>" placeholder="Category Name" required />
            </div>
            </div>
            <div class="control-group">
            <label class="control-label">Select Tenses </label>
            <div class="controls controls-row">
            <?php
            $tenses = mysqli_query($conn, "SELECT * from tenses");
            if(mysqli_num_rows($tenses) > 0)
            {
            $i = 1;

            					foreach($tenses as $tens)
            					{
            					$pktenseid = $tens["pktenseid"];
            					$tense_name = $tens["tense_name"];
            			?>
                 <div class="span3" style="margin-left:30px;">
                 <label class="checkbox-inline">
            	 <input type="checkbox" name="tenses" value="<?php echo $tens['pktenseid']; ?>" checked = "<?php echo $tens["tense_name"]; ?>"/> <?php echo $tens['tense_name']; ?>
            	 
            	 </label>
            	 
            	 
            	 
            	 </div>
                        <?php
            			$i++;
            					}
            				}
            			?>

            `

            • hello i want to insert value and also put first letter capital into the the table like this ....

              --------Below rough sketch of my table--student
              id firstname start_with
              1 daniyal D
              2 loreen L
              3 eainaa E

              how to use insert query to put data from input of "firstname"

              • dalecosp <label class="checkbox-inline"><input type="checkbox" name="tenses[]" value="<?php echo $tens['pktenseid']; ?>"
                <?php if(in_array($tens['tense_name'],$tensesarr)) { echo "checked"; } ?> > <?php echo $tens['tense_name']; ?>
                </label>
                This is my code i want to show only selected checkboxes in edit page

                • how to show multiple checkboxes checked in Core PHP Edit Page:

                  ps: array data

                  <div class="controls controls-row">
                  <?php
                  $tenses = mysqli_query($conn, "SELECT * from tenses");
                  if(sizeof($tenses) > 0)
                  {
                  foreach($tenses as $tens)
                  {
                  ?>
                  <div class="span3" style="margin-left:30px;">
                  <label class="checkbox-inline"><input type="checkbox" name="tenses[]" value="<?php echo $tens['pktenseid']; ?>"> <?php echo $tens['tense_name']; ?></label></div>
                  <?php
                  }
                  }
                  ?>
                  </div>

                  • hello i inserted data in to table A and get IDs from table A to table B in catid column like 1, 2, 3... so i want to print IDs values as per multiple ids on same row ,Here is my table and final output table

                    [upl-image-preview url=https://board.phpbuilder.com/assets/files/2020-01-14/1578989836-736965-tensess.png]

                    <?php
                    $sql = "SELECT t.tense_name, c.tenid, c.cat_name FROM tenses t, tensecategory c WHERE t.pktenseid=c.tenid";
                    $getcat = mysqli_query($conn, $sql);
                    $tenseinfo = [];
                    while ($row = mysqli_fetch_assoc($getcat)) {
                    if (!isset($tenseinfo[$row['tenid']])) {
                    $tenseinfo[$row['tenid']] = ['cat_name' => $row['cat_name'], 'tenses' => [$row['tense_name']]];
                    } else {
                    $tenseinfo[$row['tenid']]['tenses'][] = $row['tense_name'];
                    }
                    }
                    //var_dump($tenseinfo);
                    echo '<table>';
                    foreach ($tenseinfo as $catid => $data) {
                    echo '<tr><td>' . $catid . '</td>';
                    echo '<td>' . $data['cat_name'] . '</td>';
                    $tensesimpl = implode(', ', $data['tenses']);
                    echo '<td>' . $tensesimpl . '</td></tr>';
                    }
                    echo '</table>';
                    ?>