- Strength to Increase Rep
- +8
- Strength to Decrease Rep
- -2
- Upvotes Received
- 212
- Posts with Upvotes
- 159
- Upvoting Members
- 75
- Downvotes Received
- 8
- Posts with Downvotes
- 7
- Downvoting Members
- 7
266 Posted Topics
I think You need normalize DB-tables for first. create table Pensyarah( IDPensyarah integer not null primary key auto_increment , IDUser varchar(50) not null , NamaPensyarah varchar(100) not null , Email varchar(50) not null , NoTel varchar(11) not null ); create table Kursus( IDKursus integer not null primary key auto_increment , …
Use recursive printing e.g. <?php function print_recursive($list){ echo '<ul>'; foreach($list as $item){ echo '<li id="'.$item['id'].'">'.$item['text']; if( isset($item['children']) ){ print_recursive($item['children']); } echo '</li>'; } echo '</ul>'; } print_recursive($list); ?>
In your examples 2 and 3 are missing final `}` on `while` loop
What about `require` - files exists on defined path?
I think your mistake is comparing string and number  You should be use `cast(strftime('%Y', HireDate) as number)<2003`
I think your mistake is mixed use of variable names "searchdata" and "searchname"
For first check your MySQL version select version() from dual; Because all `"mysql_..."` in current (MySQL 8.0.) is deprecated - probably you should be use `"mysqli_..."` instead
1. I recomend use prepared statement instead of directly put user input data to SQL query. 2. Use [SEND_LONG_DATA](https://www.php.net/manual/en/mysqli-stmt.send-long-data.php) to store blob into database.
if you want to denormalize SQL table for search then you think wrong
Use CSS e.g. input[type="button"][value="one"] { background: blue; } input[type="button"][value="two"] { background: red; }
Radio buttons let a user select ONLY ONE of a limited number of choices Use same attribute "name" but array of values use as attribute "value" e.g. var div = document.createElement('div'); div.setAttribute('id','my_div'); document.body.appendChild(div); function addradio(){ const names=["abi","sam","tom"]; names.forEach( function(curr){ document.getElementById("my_div").innerHTML+='<br/>' +'<input type="radio" id="my_'+curr+'" name="names" value="'+curr+'" />' +'<label for="my_'+curr+'">'+curr+'</label>'; } ); …
Your mistake is comma after `$_POST['JENIS_PERMINTAAN']`. If you want to handle as array `$_POST['JENIS_PERMINTAAN'], reverse_tanggal($_POST['TGL_PERMINTAAN'])` then include it in square brackets foreach([$_POST['JENIS_PERMINTAAN'], reverse_tanggal($_POST['TGL_PERMINTAAN'])] as $idx=>$val){
Manage date in SQL query: $id = $_GET['id']; $sql = "UPDATE apparatuur SET inlever_datum = date(current_date()+7), uitleen_datum = NOW() WHERE id= ? "; $stmt = $conn->prepare($sql); $stmt->bind_param('i', $id); $status = $stmt->execute();
Create event in database [MySQL event create](https://dev.mysql.com/doc/refman/8.0/en/create-event.html)
and another question - why you do not use `pathinfo($file,PATHINFO_EXTENSION)` insead of `substr($file, strrpos($file, '.') + 1)` in line 4?
Do not need write script for this. Actually its a single line command e.g. You have directory `dir1` which contains multiple files and `dir2` which is target to copy `cp dir1/* dir2/` copy all files
@klaus.veliu - Safe version is $users=array("Vito","Joey","Vinny"); $prep=str_pad("?",count($users)*2-1,",?"); // produce string '?,?,?' $sql = "SELECT * FROM `users` WHERE `name` in (".$prep.")"; $stmt = $db->prepare($sql); $stmt->execute($users); $result = $stmt->fetchAll(PDO::FETCH_ASSOC); or $users=array("Vito","Joey","Vinny"); $sql = "SELECT * FROM `users` WHERE FIND_IN_SET(`name`,?)"; $stmt = $db->prepare($sql); $stmt->execute([implode(",",$users)]); $result = $stmt->fetchAll(PDO::FETCH_ASSOC);
Don't need `declare` - select values direct to fields DELIMITER // CREATE TRIGGER download_ins BEFORE INSERT ON download FOR EACH ROW begin set new.ip_address = inet_aton(new.`ADDRESS`); set new.vrefer=(select id from `ip_lookup` where inet_aton(new.`ADDRESS`) between ip_lookup.start and ip_lookup.end limit 1 ); END; // DELIMITER ;
Actually it do not affect any changes - `on duplicate update ...` in your example supress error message. The same can be achieved with `insert ignore into table ...`
I recommend use `join` instead of `subquery` if possible because join works faster. I think you have another table e.g. `products` which contains all product id. Select `product_id` from products and `left join` sale and purchase. Where clause exclude null values e.g. select p.product_id ,sum(s.quantity) sale ,sum(c.quantity) purchase from products …
Get value from array by key `$temp['IP_ADDRESS']` but use of `between` in your code is wrong - should be convert by `INET_ATON`
It's a very simple in single row: string='India is a democracy' print (' '.join([word for word in reversed(string.split(' '))]))
MySQL: select date_format(now(), '%d-%m-%Y'); PostgreSQL: select to_char(now(), 'dd-mm-yyyy'); OracleSQL: select to_char(sysdate, 'dd-mm-yyyy') from dual; Clause `from dual` in Oracle is required, in MySQL is optional, in PG SQL not usable - raise error
php function `time()` also return timestamp but what about it with a table create?
You can add to CSS .PaperApplication { visibility: hidden; } for set element with class PaperApplication hidden by default. After click radio button function change it to visible.
In JS months numbered from 0 to 11. Actually 11 is december. You can write simple function function addMonths(d,n){ var dt=new Date(d.getTime()); dt.setMonth(dt.getMonth()+n); return dt; } and then e.g. var d=new Date(); // current date var d1=addMonths(d,1); var d2=addMonths(d,2); var d3=addMonths(d,3); convert month number to 1-12 var n1=d1.getMonth()+1; var n2=d2.getMonth()+1; …
In your example "0" is terminator but "0" allways incrases "even". Check `if(entNum==0){ break; }` after scanf. More convenient is binary compare to 1 for test even and odd in my opinion e.g. lines 15-22 you can replace to one line: `entNum & 1 ? odd++ : even++ ;` variable …
Please post human readable HTML
In your HTML code `<table>` not opened, table row `<tr>` not opened, invalid `<input>` tag without `>` - it should be something like if($result->num_rows > 0){ echo '<table>'; while ($row6 = $result->fetch_assoc()){ //table code// echo '<tr>'; echo '<td><input type="checkbox" name="check[]" value="'.$cato.'" /></td>'; echo '</tr>'; } echo '</table>'; } PHP code …
Use backticks instead of apostrophes `attendence` AS 'type' ,`in_address` AS 'address_in' ,`out_address` AS 'address_out'
Inputs should be inside form. Inputs with similar names should be pass as array. <input type="checkbox" name="name[]" value="<?php echo $name;?>" /><?php echo $name;?>
List of enabled/disabled srvices `~$ systemctl list-unit-files` Script for enable: #!/bin/bash for i in $* do sudo systemctl enable $i done Call above script with passing multiple arguments or call below script with hardcoded services #!/bin/bash for i in eg_service_1 eg_service_2 eg_service_3 do sudo systemctl enable $i done
HTML syntax is broken - line 103 `<div`, line 122 opened `<div>` is closed inside another table cell in line 144
Must be use [contentWindow or contentDocument](https://www.w3schools.com/jsref/prop_frame_contentwindow.asp)
This looks good. Show PHP code where you try to set variables to global or session.
1. Uncripted password never store in to the database 2. Use prepared statement instead of direct passing variables to SQL query 3. Then write a question
But word `small` not in your text file examples
select min(`Date`), `Qty` from `tablename` group by extract(hour from `Date`);
Actually you can create multi level categories in single table if data structures are similar with references to self table . Second table contains references many-to-many e.g. create table `categories`( `id` int primary key not null auto_increment ,`title` varchar(30) not null ,`description` varchar(300) not null ,`op_datetime` timestamp default current_timestamp on …
Use $id = filter_input(INPUT_GET, 'id', FILTER_VALIDATE_INT); if($id !== NULL){ ... } instead of lines 4,5,6, use prepared statement intead of direct pass variable (line 7) to prevent from SQL injection. White space in GET parameter can be damage your variable `<a href="newtestpage.php?id=<?php echo $post['C_ID'];?> #editEmployeeModal" class="edit" id ="<?php echo $post['C_ID'];?>" …
Directory is created? Add to line 5 "or die('Cannot create directory')" eg `mkdir($dirname) or die ("Cannot create directory");` check web server error log file. Probably permission denied.
replace XSLT to: <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > <xsl:strip-space elements="*"/> <xsl:output method="xml" indent="yes" encoding="utf-8"/> <xsl:template match="/"> <doc xml:lang="de"> <xsl:comment>Termine</xsl:comment> <p class="T_termine_fussball"> <xsl:variable name="spieldatum" /> <xsl:for-each select="tabelle/vorschaupaarungen/vorschaupaarung"> <xsl:if test="spieldatum != preceding-sibling::vorschaupaarung[1]/spieldatum"> <span class="C_termin"> <xsl:value-of select="normalize-space(substring(spieldatum,4,7))"/> </span> </xsl:if> <span class="C_paarung"> <xsl:value-of select="heimmannschaft"/> - <xsl:value-of select="gastmannschaft"/> </span> </xsl:for-each> </p> </doc> </xsl:template> </xsl:stylesheet>
Include database (line 9) should be outside of object `User` because in line 11 you define reference to db connection which is lost after comlete user construct
Use prepared statement instead of direct insert to prevent from SQL injection! Naming checkboxes with empty quadratic brackets e.g. <input type="checkbox" name="s_id[]" value="1" /> <input type="checkbox" name="s_id[]" value="2" /> <input type="checkbox" name="s_id[]" value="3" /> PHP $s_id=filter_input(INPUT_POST,'s_id',FILTER_VALIDATE_INT,FILTER_REQUIRE_ARRAY); $date=filter_input(INPUT_POST,'datee'); $time=filter_input(INPUT_POST,'time'); $stmt = mysqli_prepare($con, "INSERT INTO table(id,s_id,date,time) VALUES(null,?,?,?)"); mysqli_stmt_bind_param($stmt, "iss", $id,$d,$t); $d=$date; $t=$time; …
Look to the console: "as" is not defined (line 29 and 95), function in parameter "ta" not used inside function.
Table name and column name in MySQL query string should be without quotes or you can use backticks.
Use prepared statement instead of direct insert to prevent from SQL injection! You try to save into table `saveoffice`? To save into tables `office1` and `office2` try something like this: <?php $link = mysqli_connect("localhost", "username", "password", "database"); $result = []; for($i=1; $i<=2; $i++){ $office = filter_input(INPUT_POST, 'offices'.$i); $result[$i] = 0; …
It is not right answer - redundant white space after hiphens right is: `(\d{3}[-]){2}\d{5}` (three digits with followed hiphens) {two times} and then five digits
I see you are using `<input type="date" />` - do not need set date by jQuery, just add value (format `YYYY-MM-DD`), e.g. `<input type="date" value="2018-09-24" />`
Read tech spec abot your graphic card - max count of monitors, sum of max pixel-width and sum of max pixel-height
The End.